Janis Lesinskis' Blog

Assorted ramblings

  • All entries
  • About me
  • Projects
  • Economics
  • Misc
  • Software-engineering
  • Sports

Making the post date more obvious


I made a small change to the templates in the site to allow the post date to be more obvious when scrolling through, this is what it looked like before:

Before dates were added

This is what it looks like after:

After dates were added

How this was done

Seeing as this site is statically generated it meant that I had to change around a template. Since this uses Jinja2 we only needed the following change:

                    <h2>
                        <a href="{{ SITEURL }}/{{ article.url }}" rel="bookmark"
                           title="Permalink to {{ article.title|striptags }}">{{ article.title }}</a>
                           - {{ article.date.strftime('%Y %B %d') }}
                    </h2>

Note the usage of strftime, if you don't use this regularly it's hard to remember all the formatting options, but thankfully the site https://strftime.org/ provides a great reference for times just like this.

Published: Wed 07 October 2020
By Janis Lesinskis
In Misc
Tags: blog UX

links

  • JaggedVerge

social

  • My GitHub page
  • LinkedIn

Proudly powered by Pelican, which takes great advantage of Python.