Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
127 changes: 127 additions & 0 deletions docs/_blog/feed_template.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
---
layout: none
permalink: feed/blog.xml
title: "Research Object Crate (RO-Crate) | Blog"
---
<?xml version="1.0" encoding="utf-8"?>
<!--This is an Atom feed adapted from https://github.com/jekyll/jekyll-feed/blob/master/lib/jekyll-feed/feed.xml under the MIT license.
Changes from that source:
* simplified how the title is set
* removed if/else statements that could adapt the feed according to tags and categories (we don't need this)
* added a check that hides posts dated in the future (the jekyll-feed gem doesn't do this for non-default collections)
-->
{% 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>
<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 %}/>
<updated>{{ site.time | date_to_xmlschema }}</updated>
<id>{{ page.url | absolute_url | xml_escape }}</id>

{% if page.title %}
<title type="html">{{ page.title | xml_escape }}</title>
{% endif %}

{% if site.description %}
<subtitle>{{ site.description | xml_escape }}</subtitle>
{% endif %}

{% if site.feed.icon %}
{% assign feed_icon = site.feed.icon %}
{% unless feed_icon contains "://" %}
{% assign feed_icon = feed_icon | absolute_url %}
{% endunless %}
<icon>{{ feed_icon | xml_escape }}</icon>
{% endif %}

{% if site.feed.logo %}
{% assign feed_logo = site.feed.logo %}
{% unless feed_logo contains "://" %}
{% assign feed_logo = feed_logo | absolute_url %}
{% endunless %}
<logo>{{ feed_logo | xml_escape }}</logo>
{% 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.blog | where_exp: "post", "post.layout == 'post'" %}
{% assign posts = posts | sort: "date" | reverse %}
{% assign posts_limit = site.feed.posts_limit | default: 10 %}
{% assign current_date = "now" | date: '%s' | integer %}
{% for post in posts limit: posts_limit %}
{% unless site.future %}
{% assign post_date = post.date | date: '%s' | integer %}
{% if post_date > current_date %}
{% continue %}
{% endif %}
{% endunless %}

<entry{% if post.lang %}{{" "}}xml:lang="{{ post.lang }}"{% endif %}>
{% assign post_title = post.title | smartify | strip_html | normalize_whitespace | xml_escape %}

<title type="html">{{ post_title }}</title>
<link href="{{ post.url | absolute_url }}" rel="alternate" type="text/html" title="{{ post_title }}" />
<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 }}"><![CDATA[{{ post.content | strip }}]]></content>
{% endunless %}

{% 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 %}

<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 %}
</author>

{% if post.category %}
<category term="{{ post.category | xml_escape }}" />
{% elsif post.categories %}
{% for category in post.categories %}
<category term="{{ category | xml_escape }}" />
{% endfor %}
{% endif %}

{% for tag in post.tags %}
<category term="{{ tag | xml_escape }}" />
{% endfor %}

{% assign post_summary = post.description | default: post.excerpt %}
{% if post_summary and post_summary != empty %}
<summary type="html"><![CDATA[{{ post_summary | strip_html | normalize_whitespace }}]]></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 %}
</entry>
{% endfor %}
</feed>
9 changes: 5 additions & 4 deletions docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ collections:
permalink: /blog/:path
output: true

feed: # RSS/Atom feed settings, used in _blog/feed_template.xml
logo: assets/img/ro-crate.svg
icon: assets/img/favicon.ico
posts_limit: 100

theme_variables:
topnav:
theme: light
Expand All @@ -115,10 +120,6 @@ theme_variables:
twitter: false
theme_color: 39989F

feed: # RSS/Atom feed settings
collections:
- blog

plugins:
- elixir-toolkit-theme-plugins
- jekyll-redirect-from
Expand Down