aboutsummaryrefslogtreecommitdiff
path: root/_includes
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2020-02-05 22:05:04 -0300
committerEuAndreh <eu@euandre.org>2020-02-05 22:05:04 -0300
commita6ae95d8bd0e9a933160fed6381b215d19d817ee (patch)
treeaad1c7e0d360a6d99d2cc4a9209a075c252e60af /_includes
parentCopy feed.atom from jekyll-feed (diff)
downloadeuandre.org-a6ae95d8bd0e9a933160fed6381b215d19d817ee.tar.gz
euandre.org-a6ae95d8bd0e9a933160fed6381b215d19d817ee.tar.xz
DIY Atom feed
Diffstat (limited to '_includes')
-rw-r--r--_includes/feed.atom97
1 files changed, 18 insertions, 79 deletions
diff --git a/_includes/feed.atom b/_includes/feed.atom
index 4d4fd16..f4243ea 100644
--- a/_includes/feed.atom
+++ b/_includes/feed.atom
@@ -1,96 +1,35 @@
-<?xml version="1.0" encoding="utf-8"?>
-{% if page.xsl %}
- <?xml-stylesheet type="text/xml" href="{{ '/feed.xslt.xml' | absolute_url }}"?>
-{% endif %}
-<feed xmlns="http://www.w3.org/2005/Atom" {% if site.lang %}xml:lang="{{ site.lang }}"{% endif %}>
- <generator uri="https://jekyllrb.com/" version="{{ jekyll.version }}">Jekyll</generator>
+<?xml version="1.0" encoding="UTF-8"?>
+<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="{{ include.lang }}">
<link href="{{ page.url | absolute_url }}" rel="self" type="application/atom+xml" />
- <link href="{{ '/' | absolute_url }}" rel="alternate" type="text/html" {% if site.lang %}hreflang="{{ site.lang }}" {% endif %}/>
+ <link href="{{ '/' | absolute_url }}" rel="alternate" type="text/html" hreflang="{{ include.lang }}" />
<updated>{{ site.time | date_to_xmlschema }}</updated>
<id>{{ page.url | absolute_url | xml_escape }}</id>
- {% assign title = site.title | default: site.name %}
- {% if page.collection != "posts" %}
- {% assign collection = page.collection | capitalize %}
- {% assign title = title | append: " | " | append: collection %}
- {% endif %}
- {% if page.category %}
- {% assign category = page.category | capitalize %}
- {% assign title = title | append: " | " | append: category %}
- {% endif %}
+ <title type="html">{{ site.title | smartify | xml_escape }}</title>
+ <subtitle>{{ site.t.feed_title[include.lang] | smartify | xml_escape }}</subtitle>
- {% if title %}
- <title type="html">{{ title | smartify | xml_escape }}</title>
- {% endif %}
+ <author>
+ <name>{{ site.author.name | xml_escape }}</name>
+ <email>{{ site.author.email | xml_escape }}</email>
+ </author>
- {% if site.description %}
- <subtitle>{{ site.description | xml_escape }}</subtitle>
- {% endif %}
-
- {% if site.author %}
- <author>
- <name>{{ site.author.name | default: site.author | xml_escape }}</name>
- {% if site.author.email %}
- <email>{{ site.author.email | xml_escape }}</email>
- {% endif %}
- {% if site.author.uri %}
- <uri>{{ site.author.uri | xml_escape }}</uri>
- {% endif %}
- </author>
- {% endif %}
-
- {% assign posts = site[page.collection] | where_exp: "post", "post.draft != true" | sort: "date" | reverse %}
- {% if page.category %}
- {% assign posts = posts | where: "category",page.category %}
- {% endif %}
- {% for post in posts limit: 10 %}
- <entry{% if post.lang %}{{" "}}xml:lang="{{ post.lang }}"{% endif %}>
+ {% assign posts = site.posts | where:"lang", include.lang | sort: "date" | reverse %}
+ {% for post in posts %}
+ <entry xml:lang="{{ post.lang }}">
<title type="html">{{ post.title | smartify | strip_html | normalize_whitespace | xml_escape }}</title>
<link href="{{ post.url | absolute_url }}" rel="alternate" type="text/html" title="{{ post.title | xml_escape }}" />
<published>{{ post.date | date_to_xmlschema }}</published>
- <updated>{{ post.last_modified_at | default: post.date | date_to_xmlschema }}</updated>
- <id>{{ post.id | absolute_url | xml_escape }}</id>
- {% assign excerpt_only = post.feed.excerpt_only | default: site.feed.excerpt_only %}
- {% unless excerpt_only %}
- <content type="html" xml:base="{{ post.url | absolute_url | xml_escape }}">{{ post.content | strip | xml_escape }}</content>
- {% endunless %}
+ <updated>{{ post.updated_at | default: post.date | date_to_xmlschema }}</updated>
+ <id>{{ post.url | absolute_url | xml_escape }}</id>
- {% assign post_author = post.author | default: post.authors[0] | default: site.author %}
- {% assign post_author = site.data.authors[post_author] | default: post_author %}
- {% assign post_author_email = post_author.email | default: nil %}
- {% assign post_author_uri = post_author.uri | default: nil %}
- {% assign post_author_name = post_author.name | default: post_author %}
+ <content type="html" xml:base="{{ post.url | absolute_url | xml_escape }}">{{ post.content | strip | xml_escape }}</content>
<author>
- <name>{{ post_author_name | default: "" | xml_escape }}</name>
- {% if post_author_email %}
- <email>{{ post_author_email | xml_escape }}</email>
- {% endif %}
- {% if post_author_uri %}
- <uri>{{ post_author_uri | xml_escape }}</uri>
- {% endif %}
+ <name>{{ site.author.name | xml_escape }}</name>
+ <email>{{ site.author.email | xml_escape }}</email>
</author>
- {% if post.category %}
- <category term="{{ post.category | xml_escape }}" />
- {% endif %}
-
- {% for tag in post.tags %}
- <category term="{{ tag | xml_escape }}" />
- {% endfor %}
-
- {% if post.excerpt and post.excerpt != empty %}
- <summary type="html">{{ post.excerpt | strip_html | normalize_whitespace | xml_escape }}</summary>
- {% endif %}
-
- {% assign post_image = post.image.path | default: post.image %}
- {% if post_image %}
- {% unless post_image contains "://" %}
- {% assign post_image = post_image | absolute_url %}
- {% endunless %}
- <media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="{{ post_image | xml_escape }}" />
- <media:content medium="image" url="{{ post_image | xml_escape }}" xmlns:media="http://search.yahoo.com/mrss/" />
- {% endif %}
+ <summary type="html">{{ post.excerpt | strip_html | normalize_whitespace | xml_escape }}</summary>
</entry>
{% endfor %}
</feed>