Headline Generator

I’d love to be able to write something like http://kingsumo.com/apps/headlines/ that worked with Hugo. I’m thinking that it would be a combination of javascript, server-side analytics and eventual resolution.

  1. Have an array of different headlines in the front matter.
  2. On the build, add all those headlines as javascript variables, which will be auto-rotated.
  3. The effectiveness of each headline will be tracked with Google Analytics or some other package.
  4. After x amount of time (defined in the front matter or site config), make an API call using https://github.com/spf13/hugo/pull/748 to see what the top performer is, then lock that in as the permanent page title.

Does that sound like a reasonable way to approach things? Are all of the right hooks available in the Hugo build process to make it happen?

I like the idea, being a static site generator and all. I would probably think a little simpler:

  • Add the different titles to front matter, each with an id (I’m not sure how GA works with this, but I assume it needs a label of kind)
  • At BUILD TIME, pick the next (or random?) title.
  • Then do builds n times a day
  • Then write a script that picks and locks “the winner” after n days

And having the title “fixed” (as not client generated) might also make it possible to get these different headlines into the Facebook / Twitter previews?

@bjornerik I thought about doing something like that, but short of deploying once a minute or something, it would be hard to really make the results statistically significant. Most times you post, you’ll see a spike in initial traffic that tails off, and your early visitors will be a different demographic than those who come later.

You might be able to get away with a switch or two at the beginning, but Facebook for sure caches the title and image, so you can’t switch things around much. I believe that after 50 views or so they lock it in.