My Profile Photo

Sheogorath's Blog

Jekyll, RSS and absolute URLs

Today I learned that I did absolute URLs overly complicated. In this blog I use absolute URLs for almost all links in order to make things RSS standard compliant. In Jekyll this can be achieved in various way, and so far, I used a very explicit way looking like this: {{ site.url }}{{ site.baseurl }}/assets/images/2016/03/some-picture.png. But the same thing can be achieved so much easier but simply using {{ "/assets/images/2016/03/some-picture.png" | absolute_url }}.

I came across that when I added the picture to the last TIL article. I checked my other image links to copy the URL prefix, but came across some older posting using the | relative_url filter. I remembered that an | absolute_url filter exists, tried it and considered it worth an own little article. Sometimes we know things, but that doesn’t mean we learned them, now I learned using the filter.