Add Atom feeds for categories and tags

This commit is contained in:
Michael Fabian 'Xaymar' Dirks
2022-01-11 04:26:31 +01:00
parent 6ab54af0e1
commit 3bbec65141
4 changed files with 60 additions and 10 deletions
+15 -2
View File
@@ -55,7 +55,7 @@ url: 'https://www.xaymar.com' # the base hostname & protocol for your site, e.g.
permalink: '/articles/:year/:month/:day/:slug/'
# Themeing
#ignore_theme_config: true
ignore_theme_config: true
#theme: null
collections:
@@ -123,6 +123,19 @@ xaymar:
identifier: 'xaymars-blog'
url: 'https://www.xaymar.com:pageurl'
############################################################
# Jekyll-feed
feed:
posts_limit: 100
excerpt_only: true
categories:
- "Blog"
- "News"
- "Reviews"
tags:
path: "/feed/tag/"
############################################################
# Site configuration for the Jekyll 3 Pagination Gem
# The values here represent the defaults if nothing is set
@@ -215,7 +228,7 @@ autopages:
# Tag pages, omit to disable
tags:
layouts:
- 'index.liquid'
- 'index_tags.liquid'
title: 'Tag: :tag' # :tag is replaced by the tag name
permalink: '/tag/:tag'
silent: false
+10 -8
View File
@@ -1,7 +1,6 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
{% comment %}
{% assign csp="default-src *; script-src 'self'" %}
@@ -14,11 +13,10 @@
<meta http-equiv="X-Content-Security-Policy" content="{{ csp }}">
<meta http-equiv="X-WebKit-CSP" content="{{ csp }}">
{% endcomment %}
{% if page.title == nil %}
<title>{{ site.title }} - {{ site.tagline }} </title>
{% else %}
<title>{{ page.title }} | {{ site.title }} - {{ site.tagline }} </title>
{% endif %}
<meta charset="utf-8" />
{% comment %}
Support for OpenGraph
{% endcomment %}
{% if page.url != nil %}
<meta property="og:url" content="{{ page.url | absolute_url }}" />
{% else %}
@@ -44,8 +42,12 @@
<meta property="og:video" content="{{ page.video | absolute_url }}?timestamp={{ page.date | default: site.time | date_to_xmlschema }}" />
{% endif %}
<meta property="article:published_time" content="{{ page.date | default: site.time | date_to_xmlschema }}" />
{% if page.title == nil %}
<title>{{ site.title }} - {{ site.tagline }} </title>
{% else %}
<title>{{ page.title }} | {{ site.title }} - {{ site.tagline }} </title>
{% endif %}
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="color-scheme" content="dark">
<link rel="icon" href="{{ site.xaymar.data.logo | absolute_url }}?timestamp={{ site.time | date_to_xmlschema }}">
<link rel="stylesheet" href="{{ site.xaymar.data.css | absolute_url }}?timestamp={{ site.time | date_to_xmlschema }}">
<link rel="alternate" type="application/rss+xml" href="{{ site.xaymar.data.rss | absolute_url }}">
<link rel="alternate" type="application/atom+xml" title="All Articles" href="{{ site.xaymar.data.rss | absolute_url }}">
+6
View File
@@ -1,4 +1,10 @@
{% include page_start.liquid %}
{% for data in page.categories %}
<link rel="alternate" type="application/atom+xml" title="Category: {{ data }}" href="{{ site.feed.categories.path | append: data | append: ".xml" | absolute_url }}">
{% endfor %}
{% for data in page.tags %}
<link rel="alternate" type="application/atom+xml" title="Tag: {{ data }}" href="{{ site.feed.tags.path | append: data | append: ".xml" | absolute_url }}">
{% endfor %}
{% include page_content.liquid %}
{% include breadcrumbs.liquid title=page.title permalink=page.url %}
{% include article.liquid type=post title=page.title content=page.content timestamp=page.date permalink=page.url tags=page.tags %}
+29
View File
@@ -0,0 +1,29 @@
{% include page_start.liquid %}
<link rel="alternate" type="application/atom+xml" title="Tag: {{ page.autopage.display_name }}" href="{{ site.autopages.tags.permalink | replace: ":tag", page.autopage.display_name | absolute_url }}">
{% include page_content.liquid %}
{% include breadcrumbs.liquid title=page.title permalink=page.url %}
<div id="index">
{% for data in paginator.posts %}
{% if site.xaymar.index.excerpt.enabled %}
{% assign content=data.excerpt | strip_html | normalize_whitespace | truncatewords: site.xaymar.index.excerpt.length %}
{% else %}
{% assign content=data.content %}
{% endif %}
{% include article.liquid type=post index=true title=data.title content=content permalink=data.url categories=data.categories tags=data.tags timestamp=data.date %}
{% endfor %}
</div>
{% if paginator.total_pages > 1 %}
<ul class="pager">
{% if paginator.previous_page %}
<li class="previous">
<a href="{{ paginator.previous_page_path | absolute_url }}">&larr; Newer Posts</a>
</li>
{% endif %}
{% if paginator.next_page %}
<li class="next">
<a href="{{ paginator.next_page_path | absolute_url }}">Older Posts &rarr;</a>
</li>
{% endif %}
</ul>
{% endif %}
{% include page_end.liquid %}