Perl programmer for hire: download my resume (PDF).
John Bokma's Hacking & Hiking

SEO friendly titles for tumblelog

April 12, 2019

One of the big issues with the tumblelog program, both the Perl and Python version, I wrote is that it doesn't use SEO friendly titles. For the main index page and the week overviews it's hard to come up with a title that makes sense other than "everything but the kitchen sink". But for the day pages, which in my case have only a few entries, it might be possible to come up with a title that gives an idea of what's on such a page.

So yesterday I added the required additional code to the Perl version of the program and today I ported the Perl additions over to the Python version.

In the tumblelog template the following:

    <title>[% name %]: a Tumblelog by [% author %] - [% label %]</title>

must be replaced with

    <title>[% title %]</title>

to get the SEO friendly titles. The title is expanded to a title given after the ISO 8601 date in the blog input file with the name of the blog added to it. For example, in my case the blog is named Plurrrr and the following line:

2019-04-12 Happy birthday Alice, more SEO friendly

Results in the following title:

Happy birthday Alice, more SEO friendly - Plurrrr

For the other pages the name, as specified by the --name argument on the command line, is combined with the label for the page, so in my case the title of the index page becomes: "Plurrrr - home". And a week overview page, for example week 15 of 2019, becomes: "Plurrrr - week 15, 2019". Note that the format of the week label can be controlled via the option --label-format, see --help.

The updated version of both the Perl and the Python programs is available on [GitHub]((https://github.com/john-bokma/tumblelog).

Related