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
8 changes: 8 additions & 0 deletions .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,14 @@ module.exports = function (eleventyConfig) {
.sort((a, b) => a.date - b.date)
.slice(-5);
});
eleventyConfig.addCollection("blogPosts", function (collectionApi) {
return collectionApi.getFilteredByTag("posts").filter((post) => {
const inputPath = post.inputPath || "";
const normalized = inputPath.replace(/^[.\\/]*posts[\\/]/, "");
const directory = normalized.split(/[/\\]/)[0];
return directory === "blog";
});
});
eleventyConfig.addCollection("tagList", require("./_11ty/getTagList"));
// Copy migrated assets from src/assets to /assets in the built site.
eleventyConfig.addPassthroughCopy({ "src/assets": "assets" });
Expand Down
3 changes: 3 additions & 0 deletions _headers
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@
cache-control: public,max-age=31536000,immutable
/favicon.svg
cache-control: public,max-age=3600

/blog/feed
Content-Type: application/atom+xml; charset=UTF-8
29 changes: 29 additions & 0 deletions blog/feed.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
permalink: blog/feed
eleventyExcludeFromCollections: true
---
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>{{ metadata.title }} - Blog</title>
<subtitle>{{ metadata.feed.subtitle }}</subtitle>
{% set absoluteUrl %}{{ "/blog/feed" | url | absoluteUrl(metadata.url) }}{% endset %}
<link href="{{ absoluteUrl }}" rel="self"/>
<link href="{{ metadata.url }}/blog/"/>
<updated>{{ collections.blogPosts | rssLastUpdatedDate }}</updated>
<id>{{ metadata.url }}/blog/</id>
<author>
<name>{{ metadata.author.name }}</name>
</author>
{%- for post in collections.blogPosts %}
{% set absolutePostUrl %}{{ post.url | url | absoluteUrl(metadata.url) }}{% endset %}
<entry>
<title>{{ post.data.title }}</title>
<link href="{{ absolutePostUrl }}"/>
<updated>{{ post.date | rssDate }}</updated>
<id>{{ absolutePostUrl }}</id>
<content type="html">
{{ post.templateContent | htmlToAbsoluteUrls(absolutePostUrl) }}
</content>
</entry>
{%- endfor %}
</feed>
Loading