Skip to content

Commit

Permalink
Add a new RSS feed for security advisories
Browse files Browse the repository at this point in the history
While at it, improve the titles of the feed links from the page head.

Fixes #185
  • Loading branch information
aperezdc committed Nov 27, 2024
1 parent 1f6c9e3 commit 070d7ad
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 2 deletions.
7 changes: 7 additions & 0 deletions .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@ module.exports = function(eleventyConfig) {
});
})

eleventyConfig.addCollection("recentWSAs", (collectionApi) => {
let i = 0;
return collectionApi.getFilteredByTag("WSA").reverse().filter((item) => {
return i++ < 6;
});
})

eleventyConfig.addCollection("pkgCatalog", collection => {
let pkgCatalog = new Object;
collection.getAll().forEach(item => {
Expand Down
5 changes: 3 additions & 2 deletions _includes/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@
<meta name="description" content="{{ page_description | escape }}">
{%- endif %}
<link rel="canonical" href="{{ page.url | replace:'index.html','' | htmlBaseUrl: site.base_url }}">
<link rel="alternate" type="application/rss+xml" title="{{ site.title }}" href="{{ '/feed.xml' | htmlBaseUrl: site.base_url }}">
<link rel="alternate" type="application/rss+xml" title="WPE blog" href="{{ '/blog.xml' | htmlBaseUrl: site.base_url }}">
<link rel="alternate" type="application/rss+xml" title="WPE WebKit Blog" href="{{ '/blog.xml' | htmlBaseUrl: site.base_url }}">
<link rel="alternate" type="application/rss+xml" title="WPE WebKit Posts" href="{{ '/feed.xml' | htmlBaseUrl: site.base_url }}">
<link rel="alternate" type="application/rss+xml" title="WPE WebKit Security Advisories" href="{{ '/security.xml' | htmlBaseUrl: site.base_url }}">

{%- comment %}
<!-- OpenGraph metadata, see https://ogp.me -->
Expand Down
31 changes: 31 additions & 0 deletions security.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---json
{
"eleventyExcludeFromCollections": true,
"permalink": "/security.xml",
"metadata": {
"title": "WPE WebKit Security Advisories",
"description": "WebKit Security Advisories from wpewebkit.org",
"url": "https://wpewebkit.org/security/",
"feedUrl": "https://wpewebkit.org/security.xml"
}
}
---
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>{{ metadata.title }}</title>
<description>{{ metadata.description }}</description>
<link href="{{ metadata.feedUrl }}" rel="self"/>
<link href="{{ metadata.url }}"/>
<updated>{{ collections.recentWSAs | getNewestCollectionItemDate | dateToRfc3339 }}</updated>
<id>{{ metadata.url }}</id>
{%- for post in collections.recentPosts %}
{% set absolutePostUrl %}{{ post.url | url | absoluteUrl(metadata.url) }}{% endset %}
<entry>
<title>{{ post.data.title }}</title>
<link href="{{ absolutePostUrl }}"/>
<updated>{{ post.date | dateToRfc3339 }}</updated>
<id>{{ absolutePostUrl }}</id>
<content type="html">{{ post.templateContent | htmlToAbsoluteUrls(absolutePostUrl) }}</content>
</entry>
{%- endfor %}
</feed>

0 comments on commit 070d7ad

Please sign in to comment.