hexo/node_modules/hexo-generator-feed/rss2.xml

64 lines
2.7 KiB
XML
Raw Normal View History

2023-10-03 11:14:36 +08:00
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
<title>{{ config.title }}</title>
<link>{{ url }}</link>
{% if icon %}
<image>
<url>{{ icon }}</url>
<title>{{ config.title }}</title>
<link>{{ url }}</link>
</image>
{% endif %}
<atom:link href="{{ feed_url | uriencode }}" rel="self" type="application/rss+xml"/>
{% if config.feed.hub %}<atom:link href="{{ config.feed.hub | uriencode }}" rel="hub"/>{% endif %}
<description>{{ config.description }}</description>
<pubDate>{% if posts.first().updated %}{{ posts.first().updated.toDate().toUTCString() }}{% else %}{{ posts.first().date.toDate().toUTCString() }}{% endif %}</pubDate>
<generator>http://hexo.io/</generator>
{% for post in posts.toArray() %}
<item>
<title>{{ post.title }}</title>
<link>{{ post.permalink | uriencode }}</link>
<guid>{{ post.permalink | uriencode }}</guid>
<pubDate>{{ post.date.toDate().toUTCString() }}</pubDate>
{% if post.description %}
<description>{{ post.description }}</description>
{% elif post.intro %}
<description>{{ post.intro }}</description>
{% elif post.excerpt %}
<description>{{ post.excerpt }}</description>
{% 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 %}
<description>{{ short_content.substring(0, delim_pos) }}</description>
{% else %}
<description>{{ short_content }}</description>
{% endif %}
{% else %}
<description>{{ short_content }}</description>
{% endif %}
{% endif %}
{% if post.image %}
<enclosure url="{{ url + post.image | uriencode }}" type="image"/>
{% endif %}
{% if config.feed.content and post.content %}
<content:encoded><![CDATA[{{ post.content | noControlChars | safe }}]]></content:encoded>
{% endif %}
{% for category in post.categories.toArray() %}
<category domain="{{ url + category.path | uriencode }}">{{ category.name }}</category>
{% endfor %}
{% for tag in post.tags.toArray() %}
<category domain="{{ url + tag.path | uriencode }}">{{ tag.name }}</category>
{% endfor %}
{% if post.comments %}
<comments>{{ post.permalink | uriencode }}#disqus_thread</comments>
{% endif %}
</item>
{% endfor %}
</channel>
</rss>