jlelse's Blog

Thoughts, stories and ideas

Hugo

How my blogroll gets generated (now completely automatic!)

Yesterday I teased a new post about how I automated my blogroll generation by writing a Go script and using the Miniflux API. Here it is.

Read more

Cache Hugo modules in Drone CI

Today I modified my theme to use Twemoji for emojis. To add the SVG files to the theme, I used a Hugo module mount in the config of my theme: module: imports: - path: github.com/twitter/twemoji mounts: - source: assets/svg target: static/twemoji/svg The problem now is that Hugo needs to download more then 3000 SVG files from GitHub when there is no cache. And because my blog builds on Drone CI, each time in a new container, there’s no cache and the build time increased by about 10 seconds.

Read more

in πŸ’¬ Micro
Reply to: A note by Henrique Dias

That’ll be hard to do with Hugo. There’s no way to tell it to use absolute URLs in the feeds only. I’ll need to set up an extra step of some kind. I’ll check it out. I use a partial in my Hugo theme to replace relative links with absolute links in the content in XML (RSS) and JSON (JSON Feed, ActivityStream) files. It has a regular expression to find and replace all relative links with their abolute version.

Read more

My own Static Site Generator

in πŸ’­ Thoughts

Because I don’t have enough side projects yet, I started programming my own static site generator, with the creative name GoBlog. I doubt it will replace my use of Hugo in the near future, but it is exciting to write a Go program that is designed for high speed. I get to know features that I have never used before. I also learn what to pay attention to when thousands of files have to be parsed and processed concurrently.

Read more

in πŸ’¬ Micro

To give readers a bit more context, I’ve extended my Hugo theme so that it will be displayed below each post if it is mentioned or linked in another post on my blog. This increases the build time from about 7 to about 17 seconds (on my machine it takes 2 seconds, but it is also much faster than the VPS), but I don’t know how I can make it more performant.

Read more

in πŸ’¬ Micro
Reply to: A reply by Henrique Dias

I played a bit with 11ty today and came to the conclusion to stay with Hugo for now. Much of what Hugo brings with it (multilingual websites, taxonomies etc.) has to be done manually. Sure, 11ty is much more flexible and everything is somehow possible, but somehow it’s too much effort for me (at least for the moment). I have a working Hugo site and it would be best to stick with it for now and start thinking more about things I can blog about instead of just the site itself.

Read more

Eleventy

in πŸ”— Links

I’m currently browsing the docs of the static site generator Eleventy (also known as 11ty). Although I prefer Go and I’m not a big JavaScript (and npm) fan for various reasons, I now consider Eleventy as an alternative to Hugo for my blog. I’m reaching the limits of Hugo more often and have to find complicated workarounds, because it’s almost impossible to add custom functionalities to Hugo. Eleventy is apparently very flexible and can be easily extended.

Read more

in πŸ’¬ Micro

The ActivityStreams module for Hugo should work with image attachments too. This is a test post to see how they are displayed on Mastodon. But I want to take the opportunity to introduce my readers to Unsplash, where you can find many nice photos for free use. Like this picture from NASA.

πŸ–ΌοΈ Read more

in πŸ’¬ Micro
Reply to: A toot by Jan Boddez

Mastodon doesn’t support “Article” posts and only shows the summary from them. But not only that, it doesn’t seem to unescape escaped HTML and that’s why articles from my blog looked so weird on Mastodon, while they worked fine on Pleroma and Microblog.pub. I now fixed the escaping. My Hugo module for ActivityStreams representation is available on Codeberg.

Read more

Pure CSS Lightbox in Hugo theme

Hugo themes have the option to override the default rendering of Markdown images by using “Markdown Render Hooks” since version 0.62.0. By creating a file in layouts/_default/_markup named render-image.html it is possible to use a custom template for rendered images. This gives a lot of flexibility. I just used that flexibility to create a lightbox with pure CSS (without using JavaScript, like many lightbox implementations do). After clicking (or tapping) on an content image, you will see it filling the browser view.

Read more

Jan-Lukas Else