-
Notifications
You must be signed in to change notification settings - Fork 1
/
atom.xml.liquid
65 lines (65 loc) · 2.84 KB
/
atom.xml.liquid
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
---
eleventyExcludeFromCollections: true
---
{% comment %}
Outputs an Atom feed
Key properties
- collectioName: string
- title: defaults to site.title
- description: defaults to site.description
- url: path of HTML file that this feed represents defaults to root
{% endcomment %}
{%- assign feedCollection = collections[collectionName] | reverse -%}
{%- assign alternateUrl = url | default: "/" | replace: " ", "%20" | addBaseUrl -%}
{%- comment %}add syndication for RSS based webmention sender{% endcomment -%}
{%- capture bridgyFed %}{% if page.url == "/feed-all.xml" -%}
<a href="https://fed.brid.gy/" class="u-bridgy-fed" aria-hidden="true" tabindex="-1"></a>
{%- endif %}{% endcapture -%}
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet href="/assets/feed.xsl" type="text/xsl"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>{{ title | default: site.title }}</title>
<subtitle>{{ description | default: site.description | escape }}</subtitle>
<link href="{{ page.url | replace: " ", "%20" | addBaseUrl }}" rel="self" type="application/atom+xml"/>
<link href="{{ alternateUrl }}" rel="alternate" type="text/html"/>
<updated>{{ feedCollection | getNewestCollectionItemDate | dateToRfc3339 }}</updated>
<id>{{ alternateUrl }}</id>
<author>
<name>Anthony Ciccarello</name>
<email>{{ site.email }}</email>
</author>
{%- for post in feedCollection limit: 31 %}
{%- assign absolutePostUrl = post.url | url | addBaseUrl %}
{%- capture content %}
{%- include "featured-media.html", image: post.data.image, image_alt: post.data.image_alt, image_caption: post.data.image_caption %}
{%- include "reply-context.html", responseData: post.data.responseData %}
{%- if forloop.index <= 10 %}
{{ post.templateContent }}
{{ bridgyFed }}
{% include "syndication.html", syndication: post.data.syndication %}
{%- else %}
<p>{{ post.templateContent | strip_html | truncate: 500 }}</p>
<a href="{{ absolutePostUrl }}">Read More</a>
{%- endif %}
{% endcapture %}
<entry>
<title type="text">{{ post.data.title | default: post.data.defaultTitle }}</title>
<link href="{{ absolutePostUrl }}" rel="alternate" type="text/html"/>
<published>{{ post.date | dateToRfc3339 }}</published>
<updated>{{ post.data.lastUpdated | dateToRfc3339 }}</updated>
<id>{{ absolutePostUrl }}</id>
{%- for tag in post.data.tags %}
<category term="{{ tag }}"/>
{%- endfor %}
{%- if forloop.index <= 10 %}
<content type="html">
{{ content | sanitizeFeedContent | htmlToAbsoluteUrls: absolutePostUrl | escape }}
</content>
{%- else %}
<summary type="html">
{{ content | sanitizeFeedContent | htmlToAbsoluteUrls: absolutePostUrl | escape }}
</summary>
{%- endif %}
</entry>
{%- endfor %}
</feed>