In the past few days I’ve applied some changes to this website - are they improvements? I’d say so, but it’s a matter of taste, I guess.
Home page layout and excerpts
First of all, I have changed how posts look in the layout of the home page. I really couldn’t stand the style I put in place last summer when I started writing.
So, bit by bit, I started playing with the layout, by centring the post title, displaying the post summary under the title, followed by a rectangular slice of the cover image (when there is one).
Then I started reconsidering what I want on my home page; there seem to be two main approaches to blog home pages today:
- show the latest post in full, either on its own or followed by full versions of other recent posts before pagination starts; I would call this the ’traditional’ blog view;
- show the list of the latest posts, maybe with a summary or an automatically generated excerpt.
The standard configuration for the theme I’m using adopts the second approach, and overall I think it’s nicer, even though it requires one more click for readers that don’t use a feedreader.
Still, I thought it would be nice to show an excerpt of the text under the image, to give the reader an idea of what the post is about, but I wasn’t happy with the standard solutions I found, i.e.:
- let Hugo abruptly cut the text after a fixed number of characters, or
- manually add a separator in each post after the first paragraph or so;
Plus, these standard solutions remove all formatting from the text, while I wanted to keep the same line breaks, bold characters and links as in the post itself. Furthermore, I didn’t want to present in this excerpt the ‘dear friend’ introduction I open most posts with.
I tried to convince Hugo to do the trick in the template file, but I didn’t manage to keep the formatting the way I wanted to.
So, finally, I added the excerpt as a new parameter in Hugo’s front matter, so that the template can take care of displaying it on the home page, but I have moved the steps for the text selection and formatting adaptations to my Python pre-processing script.
This means the excerpt only works for new posts unless I explicitly re-process all of them, but that’s fine.
Pagination on the films’ poster page
I had removed the version with posters of the Films I Liked page because it didn’t seem nice to have someone open the page and have to download 400 images, and I didn’t know how to put pagination in place.
Then last week I made ‘good’ use of a day off to address the problem; I took basically a whole afternoon of trial-and-error, but I think I finally got somewhere.
It involved some inspiration from a post by Glenn McComb and CSS from Vikram Mehta, but, most important, it required understanding that the JSON file holding information for all posters wasn’t enough, and that I needed to create an (otherwise) useless page for each poster in order to have something to apply pagination to.
As a first attempt, this post by Regis Philibert showed the way to make Hugo create the pages automatically. Which was great, until it required adding ‘module mount’ configuration parameters, which made Hugo question the rest of the site.
Finally, I moved the creation of the mono-poster pages to Python as well.
Luckily, after Hugo created dozens of list pages that no one would ever see from the single-film poster pages, I found the build options that would get rid of them.
Blogroll
I started preparing a Blogroll page, then I found out there’s a whole debate about having or not a blogroll page, but I kept writing it anyway, in recognition of the people whose writing I enjoy.
Next stop, a Podroll page for podcasts.
OpenGraph fixes
This post by Michal Zelazny made me realise a possible reason why my cover image doesn’t show up in chat/social media when I share a link to a post.
The OpenGraph tags were there, automatically added by Hugo, but the automated generated path to the cover image was not correct.
It turns out, I have to add a ‘relative : true’ configuration to each post’s front matter. Maybe there is a site-wide configuration way to do it, but I haven’t found it yet.