Mayx's Home Page https://mabbs.github.io
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

105 lines
5.2 KiB

  1. ---
  2. layout: null
  3. ---
  4. {% capture cache %}
  5. {% assign feed = site.data.json_feed | default: site.json_feed %}
  6. {% assign title = site.title | smartify | jsonify %}
  7. {% assign home_page_url = "/" | absolute_url %}
  8. {% assign feed_url = "/feed.json" | absolute_url %}
  9. {% assign description = site.description | smartify | jsonify %}
  10. {% assign author_name = feed.author.name | default: site.author | default: "" %}
  11. {% assign local_avatar_url = feed.author.avatar.local_path | absolute_url %}
  12. {% assign avatar_url = feed.author.avatar.external_url | default: local_avatar_url %}
  13. {% assign hubs = feed.hubs %}
  14. {% assign post_limit = feed.post_limit | default: 20 %}
  15. {% endcapture %}{% assign cache = nil %}
  16. {
  17. "version": "https://jsonfeed.org/version/1",
  18. "title": {{ title }},
  19. "home_page_url": "{{ home_page_url }}",
  20. "feed_url": "{{ feed_url }}",
  21. "description": {{ description }},{% if feed.icon %}
  22. "icon": "{{ "/" | append: feed.icon | absolute_url }}",{% endif %}{% if feed.favicon %}
  23. "favicon": "{{ "/" | append: feed.favicon | absolute_url }}",{% endif %}{% if feed.user_comment %}
  24. "user_comment": "{{ feed.user_comment }}",{% endif %}{% if feed.author %}
  25. "author": {
  26. "name": "{{ author_name }}"{% if feed.author.url %},
  27. "url": "{{ feed.author.url }}"{% endif %}{% if avatar_url %},
  28. "avatar": "{{ avatar_url }}"{% endif %}
  29. }{% endif %}{% if feed.expired %},
  30. "expired": {{ feed.expired }}{% endif %}, {% if hubs %}
  31. "hubs": [{% for hub in hubs %}{
  32. "url": "{{ hub.url }}",
  33. "type": "{{ hub.type }}"
  34. }{% unless forloop.last %},{% endunless %}{% endfor %}],{% endif %}
  35. "items": [
  36. {% for post in site.posts limit: post_limit %}{
  37. {% capture cache %}
  38. {% assign post_json_feed = post.json_feed %}
  39. {% assign title = post.title | smartify | jsonify %}
  40. {% assign unique_url = site.url | append: post.id %}
  41. {% assign external_url = post.external_url %}
  42. {% assign date_published = post.date | date_to_xmlschema %}
  43. {% if post_json_feed.date_modified %}
  44. {% assign date_modified = post_json_feed.date_modified | date_to_xmlschema %}
  45. {% endif %}
  46. {% assign publish_as_text = post_json_feed.publish_as_text %}
  47. {% if publish_as_text %}
  48. {% assign content_key = "content_text" %}
  49. {% assign content = post.content | expand_urls: site.url | strip_html | jsonify %}
  50. {% else %}
  51. {% assign content_key = "content_html" %}
  52. {% assign content = post.content | expand_urls: site.url | jsonify %}
  53. {% endif %}
  54. {% assign summary = post_json_feed.summary | default: post.summary | default: post.excerpt | default: post.description %}
  55. {% assign local_image_url = post_json_feed.image.local_path | absolute_url %}
  56. {% assign image_url = post_json_feed.image.external_url | default: local_image_url | default: post.thumbnail | default: post.image %}
  57. {% assign local_banner_image_url = post_json_feed.banner_image.local_path | absolute_url %}
  58. {% assign banner_image_url = post_json_feed.banner_image.external_url | default: local_banner_image_url | default: post.banner_image %}
  59. {% assign post_author = post_json_feed.author %}
  60. {% assign post_author_name = post_author.name %}
  61. {% assign post_author_url = post_author.url %}
  62. {% assign post_local_avatar_url = post_author.avatar.local_path | absolute_url %}
  63. {% assign post_avatar_url = post_author.avatar.external_url | default: post_local_avatar_url %}
  64. {% if feed.use_category_as_tag %}
  65. {% assign tags = post.category | jsonify %}
  66. {% else %}
  67. {% assign tags = post.tags | jsonify %}
  68. {% endif %}
  69. {% assign attachments = post_json_feed.attachments %}
  70. {% endcapture %}{% assign cache = nil %}
  71. "id": "{{ unique_url }}",
  72. "url": "{{ unique_url }}",{% if external_url %}
  73. "external_url": {{ external_url }},{% endif %}{% if title %}
  74. "title": {{ title }},{% endif %}
  75. "date_published": "{{ date_published }}",{% if date_modified %}
  76. "date_modified": "{{ date_modified }}",{% endif %}{% if summary %}
  77. "summary": "{{ summary }}",{% endif %}{% if image_url %}
  78. "image": "{{ image_url }}",{% endif %}{% if banner_image_url %}
  79. "banner_image": "{{ banner_image_url }}",{% endif %}{% if post_author %}
  80. "author": {
  81. "name": "{{ post_author_name }}"{% if post_author_url %},
  82. "url": "{{ post_author_url }}"{% endif %}{% if post_avatar_url %},
  83. "avatar": "{{ post_avatar_url }}"{% endif %}
  84. },{% endif %} {% if tags %}
  85. "tags": {{ tags }},{% endif %} {% if attachments %}
  86. "attachments": [{% for attachment in attachments %}{
  87. "url": "{{ attachment.url }}",{% if attachment.title %}
  88. "title": "{{ attachment.title }}",{% endif %} {% if attachment.size_in_bytes %}
  89. "size_in_bytes": "{{ attachment.size_in_bytes }}",{% endif %} {% if attachment.duration_in_seconds %}
  90. "duration_in_seconds": "{{ attachment.duration_in_seconds }}",{% endif %}
  91. "mime_type": "{{ attachment.mime_type }}"
  92. }{% unless forloop.last %},{% endunless %}{% endfor %}],{% endif %}
  93. "{{ content_key }}": {{ content }}
  94. }{% unless forloop.last %},{% endunless %}
  95. {% endfor %}
  96. ]
  97. }

Powered by TurnKey Linux.