Skip to content

Commit

Permalink
added support for excerpting feed articles, added linklog support to …
Browse files Browse the repository at this point in the history
…category feed, refactored feeds to reduce duplication
  • Loading branch information
imathis committed Feb 19, 2012
1 parent 107a4af commit 895504f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
9 changes: 9 additions & 0 deletions .themes/classic/source/_includes/feed_entry.xml
@@ -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>
12 changes: 5 additions & 7 deletions .themes/classic/source/_layouts/category_feed.xml
Expand Up @@ -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>

16 changes: 4 additions & 12 deletions .themes/classic/source/atom.xml
Expand Up @@ -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>
1 change: 1 addition & 0 deletions _config.yml
Expand Up @@ -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;"
Expand Down

1 comment on commit 895504f

@CatcherITGF
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Category feed shows textile text without convert it to html. Example http://snupt.com/categories/linklog/ (see img lines)

Please sign in to comment.