Browse Source

Adding atom feed

main
Lakshmi Vyasarajan 13 years ago
parent
commit
a0fd2990d4
7 changed files with 68 additions and 4 deletions
  1. +5
    -0
      hyde/layouts/basic/content/blog/atom.xml
  2. +6
    -0
      hyde/layouts/basic/content/blog/excerpts.xml
  3. +2
    -2
      hyde/layouts/basic/content/index.html
  4. +40
    -0
      hyde/layouts/basic/layout/atom.j2
  5. +2
    -2
      hyde/layouts/basic/layout/blog.j2
  6. +12
    -0
      hyde/layouts/basic/layout/macros.j2
  7. +1
    -0
      hyde/layouts/basic/site.yaml

+ 5
- 0
hyde/layouts/basic/content/blog/atom.xml View File

@@ -0,0 +1,5 @@
===
title: BASIC blog full text feed
extends: atom.j2
listable: false
===

+ 6
- 0
hyde/layouts/basic/content/blog/excerpts.xml View File

@@ -0,0 +1,6 @@
===
title: BASIC blog excerpts feed
extends: atom.j2
excerpts_only: true
listable: false
===

+ 2
- 2
hyde/layouts/basic/content/index.html View File

@@ -9,12 +9,12 @@ description: Home page for the BASIC hyde template
<section class="blog_excerpt">
{% set latest = site.content.walk_resources_sorted_by_time()|first %}

--- if latest:
{% if latest -%}
{{ render_excerpt(latest, 'post') }}

<a class="button white medium"
href="{{ content_url(latest.url) }}">Read more&hellip;</a>

--- endif
{%- endif %}

</section>

+ 40
- 0
hyde/layouts/basic/layout/atom.j2 View File

@@ -0,0 +1,40 @@
{% from "macros.j2" import render_excerpt, render_post with context %}
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>
{% block title %}{{ resource.meta.title|default(feed_title) }}{% endblock %}
</title>
{% block self_url %}
<link href="{{ resource.url }}" rel="self" />
{% endblock %}

{% block site_url %}
<link href="{{ content_url('') }}"/>
{% endblock %}

{% block feed_extra %}
{% endblock %}

<updated>{{ now|xmldatetime }}</updated>

<id>{{ content_url(resource.url) }}/</id>

{% for res in resource.node.walk_resources_sorted_by_time() %}
<entry>
<title type="html">{{ res.meta.title }}</title>
<author><name>{{ res.meta.author }}</name></author>
<link href="{{ content_url(res.url) }}"/>
<updated>{{ res.meta.created|xmldatetime }}</updated>
<published>{{ res.meta.created|xmldatetime }}</published>
<id>{{ content_url(res.url) }}</id>
<content type="html">
{% if resource.meta.excerpts_only -%}
{{ render_excerpt(res) }}
{%- else %}
{{ render_post(res) }}
{%- endif %}
{{ res.text }}
</content>
</entry>
{% endfor %}
</feed>

+ 2
- 2
hyde/layouts/basic/layout/blog.j2 View File

@@ -56,9 +56,9 @@
</ul>
{% endif %}
{% filter markdown|typogrify -%}
{% mark post -%}
{% block post -%}{%- endblock %}
{%- endmark %}
{%- endfilter %}
</article>


+ 12
- 0
hyde/layouts/basic/layout/macros.j2 View File

@@ -1,3 +1,15 @@
{% macro render_post(res) %}
{% refer to res.url as article %}
<article>
<h3><a href="{{ content_url(res.url) }}">{{ res.meta.title }}</a></h3>
<time datetime="{{ res.meta.created.strftime('%Y-%m-%d') }}">
Posted: {{ res.meta.created.strftime('%a, %d %b %Y') }}
</time>
{{ article.post|markdown|typogrify }}
</article>
{% endmacro %}


{% macro render_excerpt(res, class=None) %}
{% refer to res.url as post %}
<article {{'class='~class if class }}>


+ 1
- 0
hyde/layouts/basic/site.yaml View File

@@ -40,6 +40,7 @@ context:
meta:
nodemeta: meta.yaml
created: !!timestamp 2010-01-01 00:00:00
author: Lakshmi Vyasarajan
sorter:
time:
attr:


Loading…
Cancel
Save