add rss feed template

315ce614460a8431610417bb5abc2cab53c88a48

Tucker McKnight <tucker.mcknight@gmail.com> | Tue Sep 02 2025

add rss feed template
main.ts:186
Before
185
186
187




188
189
    return new Date(dateString).toDateString()
  })

⁣
⁣
⁣
⁣
  eleventyConfig.addAsyncFilter("getReadMe", async (repoName, branchName) => {
    const location = getLocation(reposConfiguration, branchName, repoName)
    const config = reposConfiguration.repos[repoName]
After
185
186
187
188
189
190
191
192
193
    return new Date(dateString).toDateString()
  })

  eleventyConfig.addFilter("toDateObj", (dateString) => {
    return new Date(dateString)
  })

  eleventyConfig.addAsyncFilter("getReadMe", async (repoName, branchName) => {
    const location = getLocation(reposConfiguration, branchName, repoName)
    const config = reposConfiguration.repos[repoName]
main.ts:381
Before
380
381
382



















      navTab: "patches",
    }
  )
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
}
After
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
      navTab: "patches",
    }
  )

  // 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,
    }
  )
}
templates/feed.njk:0
Before




















⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
After
-1
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?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>