added support for excerpting feed articles, added linklog support to category feed, refactored feeds to reduce duplication

This commit is contained in:
Brandon Mathis 2012-02-18 22:45:40 -06:00
parent 107a4af528
commit 895504f274
4 changed files with 19 additions and 19 deletions

View File

@ -0,0 +1,9 @@
{% assign linklog = false %}
{% if post.external-url %}{% capture linklog %}{{ post.external-url }}{% endcapture %}{% endif %}
{% capture title_url %}{% if linklog %}{{ linklog }}{% else %}{{ site.url }}{{ post.url }}{% endif %}{% endcapture %}
{% capture title %}{% if linklog and site.linklog_marker_position_feed == 'before' %}{% unless linklog %}{{ site.standard_post_marker }}{% endunless %}{{ site.linklog_marker }} {% endif %}{{ post.title }}{% if linklog and site.linklog_marker_position_feed == 'after' %} {{ site.linklog_marker }}{% endif %}{% endcapture %}
{% capture content %}{% if site.excerpt_in_feed %}{{ post.content | excerpt | expand_urls: site.url }}<p><a rel="bookmark" href="{{ site.url }}{{ post.url }}">{{ site.excerpt_link }}</a></p>{% else %}{{ post.content | expand_urls: site.url }}<p><a rel="bookmark" href="{{ site.url }}{{ post.url }}">{{ site.permalink_label_feed }}</a></p>{% endif %}{% endcapture %}
<title type="html"><![CDATA[{{ title | cdata_escape }}]]></title>
<link href="{{ title_url }}"/>
<updated>{{ post.date | date_to_xmlschema }}</updated>
<id>{{ site.url }}{{ post.id }}</id>

View File

@ -16,12 +16,10 @@ layout: nil
<generator uri="http://octopress.org/">Octopress</generator>
{% for post in site.categories[page.category] limit: 5 %}
<entry>
<title type="html"><![CDATA[{{ post.title | cdata_escape }}]]></title>
<link href="{{ site.url }}{{ post.url }}"/>
<updated>{{ post.date | date_to_xmlschema }}</updated>
<id>{{ site.url }}{{ post.id }}</id>
<content type="html"><![CDATA[{{ post.content | expand_urls: site.url | markdownify | cdata_escape }}]]></content>
</entry>
<entry>
{% include feed_entry.xml %}
<content type="html"><![CDATA[{{ content | markdownify | cdata_escape }}]]></content>
</entry>
{% endfor %}
</feed>

View File

@ -15,17 +15,9 @@ layout: nil
<generator uri="http://octopress.org/">Octopress</generator>
{% for post in site.posts limit: 20 %}
{% assign linklog = false %}
{% if post.external-url %}{% capture linklog %}{{ post.external-url }}{% endcapture %}{% endif %}
{% capture title_url %}{% if linklog %}{{ linklog }}{% else %}{{ site.url }}{{ post.url }}{% endif %}{% endcapture %}
{% capture title %}{% if linklog and site.linklog_marker_position_feed == 'before' %}{% unless linklog %}{{ site.standard_post_marker }}{% endunless %}{{ site.linklog_marker }} {% endif %}{{ post.title }}{% if linklog and site.linklog_marker_position_feed == 'after' %} {{ site.linklog_marker }}{% endif %}{% endcapture %}
<entry>
<title type="html"><![CDATA[{{ title | cdata_escape }}]]></title>
<link href="{{ title_url }}"/>
<updated>{{ post.date | date_to_xmlschema }}</updated>
<id>{{ site.url }}{{ post.id }}</id>
{% capture content %}{{ post.content | expand_urls: site.url | cdata_escape }}<p><a rel="bookmark" href="{{ site.url }}{{ post.url }}">{{ site.permalink_label_feed }}</a></p>{% endcapture %}
<content type="html"><![CDATA[{{ content }}]]></content>
</entry>
<entry>
{% include feed_entry.xml %}
<content type="html"><![CDATA[{{ content | cdata_escape }}]]></content>
</entry>
{% endfor %}
</feed>

View File

@ -40,6 +40,7 @@ paginate: 10 # Posts per page on the blog index
pagination_dir: blog # Directory base for pagination URLs eg. /blog/page/2/
recent_posts: 5 # Posts in the sidebar Recent Posts section
excerpt_link: "Read on &rarr;" # "Continue reading" link text at the bottom of excerpted articles
excerpt_in_feed: false # Truncate excerpted articles in the atom feed
permalink_label: "&infin;"
permalink_label_feed: "&infin; Permalink"
linklog_marker: "&rarr;"