Minor Thoughts from me to you

It's 2015. I updated my footer.

I have a copyright footer at the bottom of my site. And I'd completely forgotten that it need to be updated for 2015. Shawn Blanc's post yesterday reminded me. He linked to It's 2015. Update Your Footer as a public service announcement.

Ever looked at a website and wondered if it is still in operation? Maybe a thing or two looked like they could have been updated – and then you notice the copyright notice the in the footer. "2012. Right, this site must be dead. Let's move along."

Of course, it could be that the owner just forgot to update the year in the footer. That happens a lot, especially if those years are hard-coded strings. To future-proof your footer, it's better to just let computers take care of this. Grab one of these snippets and paste that on your page (or forward this site as a friendly reminder to someone who can do it for you).

The snippets on the page are for Javascript and PHP. I didn't want a Javascript based date and my site doesn't run on PHP. I'm using Pelican, written in Python. Fortunately, it was pretty easy to make my own snippet for automatically updating the footer every year.

Pelican uses Jinja for site templates. In order to have the date in the footer, I needed a Jinja variable to hold the date. Pelican made it easy to create one.

All templates will receive the variables defined in your settings file, as long as they are in all-caps. You can access them directly.

I added this to my pelicanconf.py file:

import datetime
TODAY = datetime.date.today()

Once that was done, it was easy to add a dynamic footer to my theme's base.html file.

Copyright © 2006–{{ TODAY|strftime ('%Y') }}

And that's it. Now my site's footer will always be current with the year of the last time that I updated the site.

To make things more challenging, I did the entire change on my iPad. I used Dash for reading Python documentation. I used Textastic to update my template and settings file. Just for fun, I opened both files using Transmit's doc provider extension. Finally, I used Pythonista to actually rebuild the site and push the updated files to the server.