Skip to content

Instantly share code, notes, and snippets.

@poritsky
poritsky / article.html
Created January 10, 2012 15:29
Way to add external links to post headers in Octopress.
{% unless page.no_header %}
<header>
{% if index %}
{% if post.external-url %}<!-- Assumes you use 'external-url:' in your YAML. Change to whatever you like as long as they match. -->
<h1 class="entry-title"><a href="{{ post.external-url }}">{% if site.titlecase %}{{ post.title | titlecase }}<!-- Glyph or label that this is a link post goes here -->{% else %}{{ post.title }}{% endif %}</a></h1>
{% else %}
<h1 class="entry-title"><a href="{{ root_url }}{{ post.url }}">{% if site.titlecase %}{{ post.title | titlecase }}{% else %}{{ post.title }}{% endif %}</a></h1>
{% endif %}
{% else %}
{% if page.external-url %}<!-- The above code changes the header on your index pages (list of posts). Now this will change the header on actual post pages so the header will still link out to an external url. -->
@poritsky
poritsky / atom.xml
Created January 10, 2012 00:24
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>