rss for every category
This commit is contained in:
parent
cd6347f8c2
commit
0dde8aff3d
12 changed files with 90 additions and 88 deletions
|
@ -1,9 +1,11 @@
|
|||
const isDev = process.env.ELEVENTY_ENV === "development";
|
||||
|
||||
const baseUrl = isDev ? "http://localhost:8080" : "https://joshua.seigler.net";
|
||||
const baseUrl = isDev ? "http://localhost:8080/" : "https://joshua.seigler.net/";
|
||||
|
||||
export default {
|
||||
language: "en-US",
|
||||
title: "joshua.seigler.net",
|
||||
description: "Personal homepage of Joshua Seigler",
|
||||
baseUrl,
|
||||
author: "Joshua Seigler",
|
||||
};
|
||||
|
|
|
@ -19,10 +19,10 @@
|
|||
{%- if cover %}
|
||||
<div class="cover">
|
||||
<img src="{{ cover | url }}" alt="" loading="eager">
|
||||
<h1>{{ title }}</h1>
|
||||
<h1>{{ title }}{% if rssUrl %}<a class="rss" href="{{rssUrl}}"></a>{% endif %}</h1>
|
||||
</div>
|
||||
{%- else %}
|
||||
<h1>{{ title }}</h1>
|
||||
<h1>{{ title }}{% if rssUrl %}<a class="rss" href="{{rssUrl}}"></a>{% endif %}</h1>
|
||||
{%- endif %}
|
||||
<div class="header-meta">
|
||||
{%- if date and not omitMetadata -%}
|
||||
|
|
|
@ -1,7 +1,17 @@
|
|||
---
|
||||
layout: "base.njk"
|
||||
eleventyComputed:
|
||||
title: "{{ page.fileSlug | capitalize }}"
|
||||
tag: "{{ page.fileSlug }}"
|
||||
title: "{{ tag | capitalize }}"
|
||||
rssUrl: "
|
||||
{%- if tag == 'posts' -%}
|
||||
/feed.xml
|
||||
{%- else -%}
|
||||
{%- if tag != 'music' -%}
|
||||
/feeds/{{tag}}
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
||||
"
|
||||
---
|
||||
|
||||
{%- from "components/collectionList.njk" import collectionList with context -%}
|
||||
|
@ -9,11 +19,10 @@ eleventyComputed:
|
|||
<section data-pagefind-body>
|
||||
{{ content | safe }}
|
||||
</section>
|
||||
{% set tag = page.fileSlug %}
|
||||
{% if collections[tag] %}
|
||||
{% if tag === "posts" %}
|
||||
{% include "-taglist.njk" %}
|
||||
{% endif %}
|
||||
{{ collectionList(tag) }}
|
||||
{% endif %}
|
||||
</main>
|
||||
</main>
|
||||
|
|
|
@ -515,6 +515,21 @@ h4 {
|
|||
h1 {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
a.rss {
|
||||
float: right;
|
||||
height: 1lh;
|
||||
width: 1lh;
|
||||
margin: 0 0 0 0.5rem;
|
||||
--glowColor: #F80A;
|
||||
background: url("/icons/rss.svg");
|
||||
border-radius: 0.25em;
|
||||
opacity: 0.25;
|
||||
transition: 5s opacity;
|
||||
&:hover {
|
||||
opacity: 1;
|
||||
transition: none;
|
||||
}
|
||||
}
|
||||
.header-meta {
|
||||
font-size: var(--s-1);
|
||||
> * + *:not(:empty)::before {
|
||||
|
|
40
site/feed.njk
Normal file
40
site/feed.njk
Normal file
|
@ -0,0 +1,40 @@
|
|||
---
|
||||
eleventyExcludeFromCollections: true
|
||||
pagination:
|
||||
data: collections
|
||||
size: 1
|
||||
alias: tag
|
||||
filter:
|
||||
- all
|
||||
- pages
|
||||
- links
|
||||
- timeline
|
||||
eleventyComputed:
|
||||
finalLink: "{% if tag == 'posts' %}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>
|
||||
<subtitle>{{ collections.pages[tag].data.description or site.description }}</subtitle>
|
||||
<link href="{{ site.baseUrl }}{{ finalLink }}" rel="self" />
|
||||
<link href="{{ site.baseUrl | addPathPrefixToFullUrl }}" />
|
||||
<updated>{{ collections.posts | getNewestCollectionItemDate | dateToRfc3339 }}</updated>
|
||||
<id>{{ site.baseUrl | addPathPrefixToFullUrl }}</id>
|
||||
<author>
|
||||
<name>{{ site.author.name }}</name>
|
||||
</author>
|
||||
{%- for entry in collections[tag] | reverse %}
|
||||
{%- if entry.url and entry.date -%}
|
||||
{%- set absolutePostUrl %}{{ entry.url | htmlBaseUrl(site.baseUrl) }}{% endset %}
|
||||
<entry>
|
||||
<title>{{ entry.data.title }}</title>
|
||||
<link href="{{ absolutePostUrl }}" />
|
||||
<updated>{{ entry.date | dateToRfc3339 }}</updated>
|
||||
<id>{{ absolutePostUrl }}</id>
|
||||
<content type="html">{{ entry.content | renderTransforms(entry.data.page, site.baseUrl) }}</content>
|
||||
</entry>
|
||||
{%- endif -%}
|
||||
{%- endfor %}
|
||||
</feed>
|
|
@ -7,7 +7,7 @@ useTitle: true
|
|||
<main>
|
||||
<section data-pagefind-body>
|
||||
<ul class="collection">
|
||||
{%- for item in collections.webroll -%}
|
||||
{%- for item in collections.links -%}
|
||||
<li>
|
||||
<a href="{{item.url}}">{{item.data.title}}</a>
|
||||
{%- if item.data.date -%}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
---
|
||||
layout: "base.njk"
|
||||
eleventyComputed:
|
||||
title: "Posts tagged #{{ tag }}"
|
||||
pagination:
|
||||
data: collections
|
||||
size: 1
|
||||
|
@ -10,8 +8,11 @@ pagination:
|
|||
- posts
|
||||
- recipes
|
||||
- timeline
|
||||
permalink: /tags/{{ tag | slugify }}/
|
||||
useTitle: true
|
||||
eleventyComputed:
|
||||
title: "Posts tagged #{{ tag }}"
|
||||
permalink: /tags/{{ tag | slugify }}/
|
||||
rssUrl: /feeds/{{ tag | slugify }}.xml
|
||||
---
|
||||
{%- from "components/collectionList.njk" import collectionList with context -%}
|
||||
<main>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue