1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
---
layout: post
title: "Add RSS to TeXt Theme-d Jekyll Site"
description: A quick exploration of Jekyll Themes and how to integrate them with RSS
date: 2021-06-17
categories: rss
tags: [Jekyll, RSS, TeXt Theme]
---
Recently, I watched [DistroTube's](https://distrotube.com/) [video about Elfeed](https://youtu.be/rkSZbzGpQuM), which prompted me to set up RSS for my own website.
However, after looking through the documentation for the [TeXt Theme](https://tianqi.name/jekyll-TeXt-theme/) for [Jekyll](https://jekyllrb.com/), I found there was no out-of-the-box support for adding RSS to the bottom of the page.
In this post, I give the steps required to add the small RSS logo to the footer of your page and the appropriate HTML/Liquid code to add to implement a small RSS button in the footer of your webpage which links back to your `feed.xml` file.
I assume that you are already using the TeXt Theme, but if you are not, then this guide can still be useful, although you will have to figure out the proper locations for the RSS SVG and the button inclusion snippet yourself.
I also assume that you either already have a `feed.xml` file or are simultaneously setting up [jekyll-feed](https://github.com/jekyll/jekyll-feed) to generate this file for you.
1. Download the [RSS SVG image](https://upload.wikimedia.org/wikipedia/commons/4/46/Generic_Feed-icon.svg)[^1] to `/_includes/svg/icon/social/`, and name it `rss.svg`.
* The name is not important, so long as it is unique within this directory and memorable.
2. Add the path to your `feed.xml` file to your `_config.yml` file.
I placed this under the `paths` set, but if you can eally place it anywhere.
My `_config.yml` `paths` section now looks like this:
``` yaml
paths:
root: "/"
home: "/"
rss: "/feed.xml"
```
3. Add the following snippet to the `_includes/author-links.html` file, wherever you want it.
* The order you place the block below determines which logos are presented in which order.
* The `href` and `include .../rss.svg` can be replaced with your own values.
In the snippet provided, the code I use is shown, so the `href="..."` and `include ...` are values that I set for myself.
<!-- Need the raw block to prevent liquid from interpolating the brace stuff. -->
{% raw %}
``` html
{%- if site.paths.rss -%}
<li title="{{ _locale_string_follow | replace: '[NAME]', 'RSS' }}">
<a class="button button--circle rss-button" itemprop="sameAs" href="{{ url }} {{ site.paths.rss }}" target="_blank">
<div class="icon">{%- include svg/icon/social/rss.svg -%}</div>
</a>
</li>
{%- endif -%}
```
{% endraw %}
---
And in theory, that should be it!
Congratulations!<br>
With this being such a simple change, I will look into getting this functionality merged into the main [TeXt Theme package on GitHub](https://github.com/kitian616/jekyll-TeXt-theme), so that this "workaround" is no longer needed.
[^1]: The RSS SVG logo is licensed with: GPL, LGPL, MPL, MTL.
|