atom.xml 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <feed xmlns="http://www.w3.org/2005/Atom">
  3. <title>{{ config.title }}</title>
  4. {% if icon %}<icon>{{ icon }}</icon>{% endif %}
  5. {% if config.subtitle %}<subtitle>{{ config.subtitle }}</subtitle>{% endif %}
  6. <link href="{{ feed_url | uriencode }}" rel="self"/>
  7. {% if config.feed.hub %}<link href="{{ config.feed.hub | uriencode }}" rel="hub"/>{% endif %}
  8. <link href="{{ url | uriencode }}"/>
  9. <updated>{{ posts.first().updated.toISOString() }}</updated>
  10. <id>{{ url }}</id>
  11. {% if config.author %}
  12. <author>
  13. <name>{{ config.author }}</name>
  14. {% if config.email %}<email>{{ config.email }}</email>{% endif %}
  15. </author>
  16. {% endif %}
  17. <generator uri="http://hexo.io/">Hexo</generator>
  18. {% for post in posts.toArray() %}
  19. <entry>
  20. <title>{{ post.title }}</title>
  21. <link href="{{ (url + post.path) | uriencode }}"/>
  22. <id>{{ url + post.path }}</id>
  23. <published>{{ post.date.toISOString() }}</published>
  24. <updated>{{ post.updated.toISOString() }}</updated>
  25. {% if config.feed.content and post.content %}
  26. <content type="html"><![CDATA[{{ post.content | noControlChars | safe }}]]></content>
  27. {% endif %}
  28. <summary type="html">
  29. {% if post.description %}
  30. {{ post.description }}
  31. {% elif post.excerpt %}
  32. {{ post.excerpt }}
  33. {% elif post.content %}
  34. {% set short_content = post.content.substring(0, config.feed.content_limit) %}
  35. {% if config.feed.content_limit_delim %}
  36. {% set delim_pos = short_content.lastIndexOf(config.feed.content_limit_delim) %}
  37. {% if delim_pos > -1 %}
  38. {{ short_content.substring(0, delim_pos) }}
  39. {% else %}
  40. {{ short_content }}
  41. {% endif %}
  42. {% else %}
  43. {{ short_content }}
  44. {% endif %}
  45. {% endif %}
  46. </summary>
  47. {% for category in post.categories.toArray() %}
  48. <category term="{{ category.name }}" scheme="{{ (url + category.path) | uriencode }}"/>
  49. {% endfor %}
  50. {% for tag in post.tags.toArray() %}
  51. <category term="{{ tag.name }}" scheme="{{ (url + tag.path) | uriencode }}"/>
  52. {% endfor %}
  53. </entry>
  54. {% endfor %}
  55. </feed>