main rss feed combines posts and recipes
This commit is contained in:
parent
0dde8aff3d
commit
02732645da
3 changed files with 10 additions and 9 deletions
|
@ -8,7 +8,6 @@ import mdLinkAttributes from "markdown-it-link-attributes"
|
|||
import mdPrism from "markdown-it-prism"
|
||||
import dayjs from "dayjs"
|
||||
import utc from "dayjs/plugin/utc.js"
|
||||
import site from "./site/_data/site.js"
|
||||
import clean from "eleventy-plugin-clean"
|
||||
import toc from "eleventy-plugin-toc"
|
||||
import EleventyFeedPlugin from "@11ty/eleventy-plugin-rss"
|
||||
|
@ -114,6 +113,12 @@ export default async (config) => {
|
|||
|
||||
config.addCollection("links", fetchShaarliWebroll)
|
||||
|
||||
config.addCollection("combinedFeed", (collectionApi) => {
|
||||
return collectionApi.getAllSorted().filter(item => {
|
||||
return (item.data.tags ?? []).some(t => ['posts', 'recipes', 'links'].includes(t))
|
||||
})
|
||||
})
|
||||
|
||||
config.addFilter("toISOString", (dateString) => {
|
||||
return new Date(dateString).toISOString()
|
||||
})
|
||||
|
|
|
@ -4,13 +4,9 @@ eleventyComputed:
|
|||
tag: "{{ page.fileSlug }}"
|
||||
title: "{{ tag | capitalize }}"
|
||||
rssUrl: "
|
||||
{%- if tag == 'posts' -%}
|
||||
/feed.xml
|
||||
{%- else -%}
|
||||
{%- if tag != 'music' -%}
|
||||
/feeds/{{tag}}
|
||||
/feeds/{{tag}}.xml
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
||||
"
|
||||
---
|
||||
|
||||
|
|
|
@ -10,13 +10,13 @@ pagination:
|
|||
- links
|
||||
- timeline
|
||||
eleventyComputed:
|
||||
finalLink: "{% if tag == 'posts' %}feed.xml{% else %}feeds/{{tag | slugify}}.xml{% endif %}"
|
||||
finalLink: "{% if tag == 'combinedFeed' %}feed.xml{% else %}feeds/{{tag | slugify}}.xml{% endif %}"
|
||||
permalink: "/assets/{{finalLink}}"
|
||||
---
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml-stylesheet type="text/xsl" href="/simple-atom.xslt"?>
|
||||
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="{{ site.language }}">
|
||||
<title>{{ site.title }} - {{ tag }}</title>
|
||||
<title>{{ site.title }}{% if tag !== 'combinedFeed' %} - {{ tag }}{% endif %}</title>
|
||||
<subtitle>{{ collections.pages[tag].data.description or site.description }}</subtitle>
|
||||
<link href="{{ site.baseUrl }}{{ finalLink }}" rel="self" />
|
||||
<link href="{{ site.baseUrl | addPathPrefixToFullUrl }}" />
|
||||
|
@ -29,7 +29,7 @@ eleventyComputed:
|
|||
{%- if entry.url and entry.date -%}
|
||||
{%- set absolutePostUrl %}{{ entry.url | htmlBaseUrl(site.baseUrl) }}{% endset %}
|
||||
<entry>
|
||||
<title>{{ entry.data.title }}</title>
|
||||
<title>{% if tag == 'combinedFeed' %}{{ entry.data.tags[0].slice(0,-1) | title }}: {% endif %}{{ entry.data.title }}</title>
|
||||
<link href="{{ absolutePostUrl }}" />
|
||||
<updated>{{ entry.date | dateToRfc3339 }}</updated>
|
||||
<id>{{ absolutePostUrl }}</id>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue