Mon Sep 01 2025
Tucker McKnight <tucker.mcknight@gmail.com>
315ce614460a8431610417bb5abc2cab53c88a48
186
186
187
188
189
eleventyConfig.addFilter("toDateObj", (dateString) => {
return new Date(dateString)
})
381
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
// FEED.NJK
const feedTemplate = fsImport.readFileSync(`${__dirname}/templates/feed.njk`).toString()
eleventyConfig.addTemplate(
`repos/feed.njk`,
feedTemplate,
{
pagination: {
data: "branches",
size: 1,
alias: "branch",
},
permalink: (data) => {
const repoName = data.branch.repoName
const branchName = data.branch.branchName
return `${reposPath}/${eleventyConfig.getFilter("slugify")(repoName)}/branches/${eleventyConfig.getFilter("slugify")(branchName)}/patches.xml`
},
eleventyExcludeFromCollections: true,
}
)
0
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="{{ page.lang }}">
<title>Latest patches in {{branch.branchName}}</title>
<link href="{{ ('/repos/' + (branch.repoName | slugify) + '/branches/' + (branch.branchName | slugify) + '/patches.xml')| htmlBaseUrl(reposConfig.baseUrl) }}" rel="self" />
<link href="{{ ('/repos/' + (branch.repoName | slugify) + '/branches/' + (branch.branchName | slugify)) | htmlBaseUrl(reposConfig.baseUrl) }}" />
{% set lastPatch = repos[branch.repoName].branches[branch.branchName].patches | last %}
<updated>{{ lastPatch.date | toDateObj | dateToRfc3339 }}</updated>
<id>{{ reposConfig.baseUrl | addPathPrefixToFullUrl }}</id>
<author>
<name>{{branch.repoName}} contributors</name>
</author>
{%- for patch in repos[branch.repoName].branches[branch.branchName].patches | reverse %}
{%- set absolutePostUrl %}{{ ('/repos/' + (branch.repoName | slugify) + '/branches/' + (branch.branchName | slugify) + '/patches/' + patch.hash) | htmlBaseUrl(reposConfig.baseUrl) }}{% endset %}
<entry>
<title>{{ patch.name }}</title>
<author><name>{{ patch.author }}</name></author>
<link href="{{ absolutePostUrl }}" />
<updated>{{ patch.date | toDateObj | dateToRfc3339 }}</updated>
<id>{{ absolutePostUrl }}</id>
<content type="html">{{ patch.description | renderTransforms({}, reposConfig.baseUrl) }}</content>
</entry>
{%- endfor %}
</feed>