blog/scripts/feed/.atom.xml

61 lines
2.3 KiB
XML
Raw Normal View History

2019-08-12 11:02:22 +00:00
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>{{ config.title }}</title>
{% if icon %}<icon>{{ icon }}</icon>{% endif %}
{% if config.subtitle %}<subtitle>{{ config.subtitle }}</subtitle>{% endif %}
<link href="{{ feed_url | uriencode }}" rel="self"/>
{% if config.feed.hub %}<link href="{{ config.feed.hub | uriencode }}" rel="hub"/>{% endif %}
<link href="{{ url }}"/>
<updated>{{ posts.first().date | date }}</updated>
<id>{{ url }}</id>
{% if config.author %}
<author>
<name>{{ config.author }}</name>
{% if config.email %}<email>{{ config.email }}</email>{% endif %}
</author>
{% endif %}
<generator uri="http://hexo.io/">Hexo</generator>
{% for post in posts.toArray() %}
<entry>
<title>{{ post.title }}</title>
<link href="{{ url }}{{ post.path | uriencode }}"/>
<id>{{ url }}{{ post.path }}</id>
<published>{{ post.date | date }}</published>
<updated>{% if post.lastUpdated %}{{ post.lastUpdated | date }}{% else %}{{ post.date | date }}{% endif %}</updated>
{% if config.feed.content and post.content %}
<content type="html"><![CDATA[{{ post.more | noControlChars | safe }}]]></content>
{% endif %}
<summary type="html">
{% if post.description %}
{{ post.description }}
{% elif post.intro %}
{{ post.intro }}
{% elif post.excerpt %}
{{ post.excerpt }}
{% elif post.content %}
{% set short_content = post.content.substring(0, config.feed.content_limit) %}
{% if config.feed.content_limit_delim %}
{% set delim_pos = short_content.lastIndexOf(config.feed.content_limit_delim) %}
{% if delim_pos > -1 %}
{{ short_content.substring(0, delim_pos) }}
{% else %}
{{ short_content }}
{% endif %}
{% else %}
{{ short_content }}
{% endif %}
{% endif %}
</summary>
{% if post.image %}
<content src="{{ url }}{{ post.image | uriencode }}" type="image" />
{% endif %}
{% for category in post.categories.toArray() %}
<category term="{{ category.name }}" scheme="{{ url }}{{ category.path | uriencode }}"/>
{% endfor %}
{% for tag in post.tags.toArray() %}
<category term="{{ tag.name }}" scheme="{{ url }}{{ tag.path | uriencode }}"/>
{% endfor %}
</entry>
{% endfor %}
</feed>