Skip to content

Instantly share code, notes, and snippets.

@poritsky
Created January 10, 2012 00:24
Show Gist options
  • Save poritsky/1585914 to your computer and use it in GitHub Desktop.
Save poritsky/1585914 to your computer and use it in GitHub Desktop.
Additions to Octopress atom.xml to allow for RSS mapping to external URLs.
{% for post in site.posts limit: 20 %}
<entry>
{% if post.external-url %}
<title type="html"><![CDATA[{{ post.title | cdata_escape }}]]></title><!-- add in a glyph or [link-post] here so people know where they're ending up -->
<link href="{{ post.external-url }}"/>
{% else %}
<title type="html"><![CDATA[{{ post.title | cdata_escape }}]]></title>
<link href="{{ site.url }}{{ post.url }}"/>
{% endif%}
<updated>{{ post.date | date_to_xmlschema }}</updated>
<id>{{ site.url }}{{ post.id }}</id>
{% if post.external-url %}
<content type="html"><![CDATA[{{ post.content | expand_urls: site.url | cdata_escape }}<a rel="full-article" href="{{ site.url }}{{ post.url }}">Permalink</a>]]></content><!-- add in a glyph or some way to denote that the permalink goes back to your site -->
{% else %}
<content type="html"><![CDATA[{{ post.content | expand_urls: site.url | cdata_escape }}]]></content>
{% endif%}
</entry>
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment