local-search.xml 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <search>
  3. {% if posts %}
  4. {% for post in posts.toArray() %}
  5. {% if post.indexing == undefined or post.indexing %}
  6. <entry>
  7. <title>{{ post.title }}</title>
  8. <link href="{{ [url, post.path] | urlJoin | uriencode }}"/>
  9. <url>{{ [url, post.path] | urlJoin | uriencode }}</url>
  10. {% if content %}
  11. <content type="html"><![CDATA[{{ post.content | noControlChars | safe }}]]></content>
  12. {% endif %}
  13. {% if post.categories and post.categories.length>0 %}
  14. <categories>
  15. {% for cate in post.categories.toArray() %}
  16. <category>{{ cate.name }}</category>
  17. {% endfor %}
  18. </categories>
  19. {% endif %}
  20. {% if post.tags and post.tags.length>0 %}
  21. <tags>
  22. {% for tag in post.tags.toArray() %}
  23. <tag>{{ tag.name }}</tag>
  24. {% endfor %}
  25. </tags>
  26. {% endif %}
  27. </entry>
  28. {% endif %}
  29. {% endfor %}
  30. {% endif %}
  31. {% if pages %}
  32. {% for page in pages.toArray() %}
  33. {% if post.indexing == undefined or post.indexing %}
  34. <entry>
  35. <title>{{ page.title }}</title>
  36. <link href="{{ [url, post.path] | urlJoin | uriencode }}"/>
  37. <url>{{ [url, post.path] | urlJoin | uriencode }}</url>
  38. {% if content %}
  39. <content type="html"><![CDATA[{{ page.content | noControlChars | safe }}]]></content>
  40. {% endif %}
  41. </entry>
  42. {% endif %}
  43. {% endfor %}
  44. {% endif %}
  45. </search>