- Change
feed_url
to where the feed will be served from. - Change
feed_title
to wahtever your feed's title should show up as in feed readers. - Set
feed_alternate
to the URL where the content can be seen as regular HTML. feed_global_unique_id
uses thetag:
URI here, and should:- have
example.com
changed to your blog domain, - have
2013
changed to whatever year is appropriate for the feed starting, - use a globally unique string of characters after the second
:
, - most importantly, never ever change, even if the feed moves to a different domain or URL, or anything else --- change the ID and readers will assume entirely different content → posts will suddenly become duplicated in the likes of Google Reader.
- have
- Set your author name and a URL. In this template, it's used for all entries since each entry doesn't have its own author.
- Change the
feed_entry_tag_domain
to be a domain name that should never change. This is used intag:
URIs for the entry ID. If this changes, the entry ID changes, and feed readers will see different content → posts will suddenly become duplicated in the likes of Google Reader. If you want to change ID scheme, make sure to keep the ID the same on older posts, using a conditional.
Last active
December 14, 2015 17:49
-
-
Save aprescott/5124837 to your computer and use it in GitHub Desktop.
Sample feed.xml Liquid template for use with Serif 0.3.2. Post unique IDs are independent of URL. Note the caveats!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
layout: none | |
<?xml version="1.0" encoding="utf-8"?> | |
{% assign feed_url = "http://example.com/feed" %} | |
{% assign feed_title = "Example Feed" %} | |
{% assign feed_alternate = "http://example.com/blog" %} | |
{% assign feed_global_unique_id = "tag:example.com,2013:TOTALLY-RANDOM-STRING-OF-CHARACTERS-GOES-HERE" %} | |
{% assign feed_author_name = "J. Smith" %} | |
{% assign feed_author_url = "http://example.com/about" %} | |
{% assign feed_entry_tag_domain = "example.com" %} | |
<feed xmlns="http://www.w3.org/2005/Atom"> | |
<title>{{ feed_title }}</title> | |
<link rel="self" type="application/atom+xml" href="{{ feed_url }}"/> | |
<link rel="alternate" type="text/html" href="{{ feed_alternate }}"/> | |
<id>{{ feed_global_unique_id }}</id> | |
<updated>{{ site.latest_update_time | xmlschema }}</updated> | |
<author> | |
<name>{{ feed_author_name }}</name> | |
<uri>{{ feed_author_url }}</uri> | |
</author> | |
{% for post in site.posts limit:10 %} | |
<entry> | |
<id>tag:{{ feed_entry_tag_domain }},{{ post.created | date: "%Y-%m-%d" }}:{{ post.created | date: "%s" }}</id> | |
<title type="html">{{ post.title | smarty | replace:"&","&" | replace:"<","<" | replace:">",">" }}</title> | |
<updated>{{ post.updated | xmlschema }}</updated> | |
<published>{{ post.created | xmlschema }}</published> | |
<link href="{{ post.url }}" rel="alternate" type="text/html"/> | |
<content type="html">{{ post.content | markdown | escape }}</content> | |
</entry> | |
{% endfor %} | |
</feed> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment