Skip to content

How to Include a Footer in your Site’s Feed for Jekyll

David Ensinger

Lots of folks read blogs via syndicated feeds, so it can’t hurt to provide them with a little additional content, whether it be a link to the original post, a copyright statement, or even links your social media profiles, in the footer of each feed entry.

Example Footer for Feed Entry

The first step is to create an include for your entry footer, within which you’ll put whatever content you’d like your readers to see.

<p>You’ve just read about <strong><a href="{{ site.url }}{{ post.url }}">{{ post.title }}</a></strong> on <strong><a href="{{ site.url }}/">{{ site.title }}</a></strong>.</p>
<p>If you’d prefer to receive your updates in tweet form, please follow me on <strong><a href="">Twitter</a></strong>, otherwise I hope you’re enjoying the feed!</p>

You’ll then want to include your feed footer within the include for your feed’s entries, which will probably look a lot like the following (see the {% include feed-footer.html %}):

  <title type="text">{{ post.title | xml_escape }}</title>
  <link rel="alternate" type="text/html" href="{{ site.url }}{{ post.url }}" />
  <id>{{ site.url }}{{ }}</id>
  <published>{{ | date: "%Y-%m-%dT%H:%M:%SZ" }}</published>
  <updated>{{ | date: "%Y-%m-%dT%H:%M:%SZ" }}</updated>
  <content type="html"><![CDATA[ {{ post.content }} {% include feed-footer.html %} ]]></content>

Also be sure to properly escape the data in your posts. I prefer to use CDATA, but Jekyll also comes with a Liquid filter to escape XML: {{ post.content | xml_escape }}.