Hugo and Fixing RSS Errors

Posted on 2nd of February 2024 | 611 words

Somebody contacted me and mentioned that there is something off with my RSS feeds, thanks for that. I don’t know what had happened and when, but for some reason my normal RSS link. Didn’t contain the correct information. It seemed to only contain the summary of the post. I recently did some overhaul in my own Hugo theme and its layouts so most likely I had put something to wrong place while doing that causing this.

When I started looking at what Hugo generated, it seemed that the correct feed was actually located at the root of my site, so topikettunen.com/feed.xml but this isn’t right. I remember making it so at one point that I only generate the feed in the blog section since - personally speaking - I don’t really see the benefit of generating the feed elsewhere.

This seemed to be caused by error in my Hugo configs, which most likely I had accidentally changed at some point. I had to add the following to my config.toml:

[outputs]
  home = ["HTML"]
  section = ["HTML", "RSS"]
  taxonomy = ["HTML"]

This makes it so that Hugo generates only HTML when it comes to home and taxonomy page (so archive and tag for me). In section, like blog , it’ll generate HTML and RSS. So that was fixed.

Like I mentioned above, the RSS feed generated under section was still wrong since it only contained the summary. In my Hugo theme, I had already created a custom layouts/index.rss.xml in there with the change:

-<description>{{ .Summary | html }}</description>
+<description>{{ .Content | safeHTML }}</description>

So that it’ll generate the whole content in there instead of summary, which Hugo does by default. Unfortunately, this was one was in the wrong place for section RSS. It should be in layouts/section/section.rss.xml, and then it works fine!

Also having full content under description in the RSS XML seems quite odd so I fixed it to look like:

<description>{{ .Summary | html }}</description>
<content:encoded>{{ .Content | html }}</content:encoded>

To have both in their own correct fields.

I also noticed that my custom notice shortcode looked quite ugly in the RSS feed. You might’ve seen these notices e.g. when reading my Sila dev log. The way I had done this shortcode was the having the following in layouts/shortcodes/notice.html:

<table class="notice">
  <tbody>
    <tr>
      <td>
        {{ .Inner }}
      </td>
    </tr>
  </tbody>
</table>

I know, this probably could be done with something else than table, but hey, I’m not a designer.

Which I then would call in my Markdown files like:

{{< notice >}}
<strong>Plug</strong>: <a href="https://github.com/topikettunen/sila" target="_blank">Follow the Sila development here.</a>
{{< /notice >}}

Also while writing this, I learned how to escape shortcodes in Hugo in case you want to use them in write them in your Markdown, but not actually use them. You need wrap the short code inside {{</* notice */>}}.

But unfortunately it would just generate that in the beginning of the RSS content without proper HTML tags etc. So instead of using the notice as a shortcode, I removed the shortcodes from Markdown and just added the following to my layouts/_default/single.html:

{{ if in .Params.tag "sila"}}
<table class="notice">
  <tbody>
    <tr>
      <td>
        <strong>Plug</strong>: <a href="https://github.com/topikettunen/sila" target="_blank">Follow the Sila development here.</a>
      </td>
    </tr>
  </tbody>
</table>
{{ end }}

This only works when blog has a tag sila in it. Of course, if I would like to use such a notice in some other posts, this wouldn’t work, but for now, it’s good enough for me. This way also Hugo doesn’t include the notice in the generated RSS, making the feed look little bit neater!

But hey, at least now the RSS feed should be working how it should!

List of Now Playing

Posted on 29th of November 2023 | 29 words

I just decided to gather all the songs I have included in my posts in the “Now playing” section to one neat page. This page can be found here.

Giving Mastodon a Go

Posted on 13th of October 2023 | 356 words

NB: I’ve since decided to quit Mastodon

In the digital landscape, social media is an indispensable tool for communication, networking, and content sharing. Yet, the way these platforms have been implemented and designed isn’t praiseworthy. From content suppression algorithms to opaque data policies, it’s no secret that the leading tech giants have cultivated a restrictive environment.

I’ve been vocal about social media and how wrong it has always felt to me, leading me to delete most of my social media accounts apart from LinkedIn. However, is LinkedIn truly a social media platform or merely a glorified job board? I also wrote a post about social media from the perspective of digital minimalism some time ago.

For years, I was content without any social media accounts, and still am. Recently, I yearned for an online community to engage in meaningful discussions and banter, perhaps due to my move to a new country last year or simply because of an extended hiatus from social media.

I didn’t want to return to the draconian social media platforms I once used, like Facebook, Instagram, and Twitter. Even Reddit didn’t pique my interest. Nevertheless, I sought something new, which led me to consider Mastodon.

I had followed Mastodon’s development from afar due to my reluctance to join, not because Mastodon is malevolent, but because I felt I spent too much time on computers, and joining might exacerbate that.

However, after stumbling upon intriguing threads (is there a Mastodon-specific term for these?), I decided to join Mastodon and participate in discussions. Intrigued by its promise of a democratic and transparent social media experience, I took the plunge and joined the Mastodon community, finding it a breath of fresh air.

I’m thrilled to contribute to a platform that values user autonomy, fosters genuine human connections, and champions transparency and inclusivity. Embracing Mastodon signifies not just a personal choice but also a deliberate step toward fostering a more democratic and empowering social media environment for all.

In a world rife with censorship and control, Mastodon serves as a beacon of hope, embodying technological innovation that prioritizes user well-being and digital freedom above all else.

What I Read in September 2023

Posted on 1st of October 2023 | 369 words

During September I seemed to spend quite a bit of time by reading books about addiction due to personal reasons.

Judtih Grisel: Never Enough

Grisel’s book focused mainly on how different substances work and how they cause addictions offering wonderful knowledge about the drug use and the development of human brain. Great book!

Gabor Maté: In the Realm of Hungry Ghost

Maté’s book approached addiction from the point of view of trying to answer why people become addicts. One of the most common factors between hard addicts seems to be, according to Maté, some form of trauma that causes them to seek chemical satisfaction from various substances. Book also raises a great point that addiction is really a spectrum. Everyone of us lies in some place in this spectrum.

Dr. Tom O. Bryan: You Can Fix Your Brain

While fixing somebody’s brain is definitely a hard task, it is not impossible. Bryan raises a point in this book that there is no silver-bullet for fixing your brain, but it is possible with small wins in multiple small areas. He calls these four faces of brain health pyramid, which are structure, mindset, biochemistry and electromagnetism, with what you can design a protocol for yourself.

Herman Hesse: Siddhartha (reread, but this time in German)

I’ve been tremendously interested in Buddhism ever since I was a teenager and I would consider myself being a practicing Buddhist. I have decided to start taking this practice more and more serious to try to fix somethings in my life. Siddhartha Gautama’s story is obviously a crucial part of the whole thing and Hesse’s book is a great novel for painting a picture of this. I’ve read this book earlier but in Finnish and English. Since last year I moved to Germany, I’ve been practicing my German and, at the same time, I’ve never been a huge fan of translations in books since I always feel that something always gets lost during the translation. So to improve my German I decided to read this book in its original language, German! While I’m very familiar with the story, from reading this book earlier but also from stuff like Pali canon, it’s still one of my favorite books!

So... Baldur's Gate 3 Happened

Posted on 24th of September 2023 | 274 words

Soo… Baldur’s Gate 3 was finally released after many years in open beta, and I have to be honest, it really made me forget pretty much any other project I had going on and just focus on playing it. Yesterday, I was finally able to finish the game after over 100 hours, and all I can say is that it truly was a great experience!

At one point in time, I played quite a bit of video games, but then I lost interest in playing them. Well, losing interest is maybe the wrong word, since I was still interested in what was happening in the gaming world, but I just followed it from afar without spending countless hours in those games.

Baldur’s Gate 3 really sparked this old fire again since it had many things going on in it. I loved the old Baldur’s Gates, and at the same time, many Dungeons and Dragons campaigns with friends hold a dear place in my heart, and naturally, Baldur’s Gate 3 combined those two in a truly remarkable fashion.

So I just wanted to write this small appreciation post to Larian Studios. Yes, the game had some minor bugs here and there, but nothing game-breaking (at least in my experience), but it was an absolutely amazing sequel to one of my favorite gaming series while respecting the legacy of D&D. I doubt that I will start consuming other video games endlessly like I used to, but nonetheless, Baldur’s Gate 3 was an amazing experience, and I’m glad I spent many, many hours in it.

Now, when the game is finished, I can finally return to hacking.