Amending the Title tag on a micro.blog custom theme
Optimising the Hugo title tag in micro.blog for better SEO.
I have developed my micro.blog hosted Hugo website to replace existing social media channels with a single site.
It holds snips that largely replicate the thoughts and conversation that many years ago I might have made on Twitter, and also shots that contains image posts that more recently I might have placed on Instagram. All of my long form articles are housed on this site too - everything under one roof.
For the most part the experience has been great, and I can see how that could be made even better by learning more Hugo - though thats not really the purpose of this site.
The one aspect of the experience that has either stayed the same, or feels like it has worsened is traffic. Traffic is not a primary concern for me - but I’d like at least some people to read what I write.
So I have been trying to improve the SEO of the site. There is only so much of that which can be templated - and ensuring all content has a title tag is one area. As author I need to also make sure that the titles, descriptions, and articles are also well drafted for SEO in writing as you cannot customise the Hugo frontmatter on micro.blog in the way that you might on a self hosted Hugo site.
Attached code creates different structured title tags based on whether the page is the homepage or not, and whether the page has a title or not. Its not perfect, and means that pages without titles will have a title identical to the start of the description - but better and more readable in search engines than nothing at all.
As always, Hugo strips out the Go templating language on publication, so sadly embedding as an image.
Place this code or any variant above over the top of the existing title tag in your theme - in the theme that my custom theme is built on, that is in head.html.
My view statistics are heavily polluted/inflated at the moment as I have been doing so much development live on the site, but I can see that most of the traffic is me. I’ll look back in a couple of months to see how traffic evolves, before deciding whether or not to bring my remaining macretro project across (which receives much more traffic).
