website: add atom feeds for blogs (#2233)
* website: add atom feeds for blogs * update front-matter * website: add atom and rss feeds for blogs * include full blog content --------- Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
This commit is contained in:
parent
f4b852d2dd
commit
9fa93e40cb
@ -6,6 +6,8 @@ const uri = require('fast-uri')
|
|||||||
const i18n = require('eleventy-plugin-i18n');
|
const i18n = require('eleventy-plugin-i18n');
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
const pluginRss = require('@11ty/eleventy-plugin-rss');
|
||||||
|
|
||||||
|
|
||||||
const globalConfig = {
|
const globalConfig = {
|
||||||
onionLocation: "http://isdb4l77sjqoy2qq7ipum6x3at6hyn3jmxfx4zdhc72ufbmuq4ilwkqd.onion",
|
onionLocation: "http://isdb4l77sjqoy2qq7ipum6x3at6hyn3jmxfx4zdhc72ufbmuq4ilwkqd.onion",
|
||||||
@ -63,6 +65,8 @@ module.exports = function (ty) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
ty.addPlugin(pluginRss);
|
||||||
|
|
||||||
ty.addPlugin(i18n, {
|
ty.addPlugin(i18n, {
|
||||||
translations,
|
translations,
|
||||||
fallbackLocales: {
|
fallbackLocales: {
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@11ty/eleventy": "^1.0.1",
|
"@11ty/eleventy": "^1.0.1",
|
||||||
|
"@11ty/eleventy-plugin-rss": "^1.2.0",
|
||||||
"@simplex-chat/webrtc": "^0.1.1",
|
"@simplex-chat/webrtc": "^0.1.1",
|
||||||
"common-tags": "^1.8.2",
|
"common-tags": "^1.8.2",
|
||||||
"fast-uri": "^2.1.0",
|
"fast-uri": "^2.1.0",
|
||||||
|
37
website/src/blogs-atom-feed.njk
Normal file
37
website/src/blogs-atom-feed.njk
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
---
|
||||||
|
permalink: feed.atom
|
||||||
|
eleventyExcludeFromCollections: true
|
||||||
|
metadata:
|
||||||
|
title: SimpleX Chat Blog
|
||||||
|
subtitle: It allows you to stay up to date with the latest Blogs from SimpleX Chat.
|
||||||
|
language: en
|
||||||
|
url: https://simplex.chat/,
|
||||||
|
author:
|
||||||
|
name: SimpleX Chat
|
||||||
|
email: chat@simplex.chat
|
||||||
|
---
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<feed xmlns="http://www.w3.org/2005/Atom" xml:base="{{ metadata.url }}">
|
||||||
|
<title>{{ metadata.title }}</title>
|
||||||
|
<subtitle>{{ metadata.subtitle }}</subtitle>
|
||||||
|
<link href="{{ permalink | absoluteUrl(metadata.url) }}" rel="self"/>
|
||||||
|
<link href="{{ metadata.url }}"/>
|
||||||
|
<updated>{{ collections.blogs | getNewestCollectionItemDate | dateToRfc3339 }}</updated>
|
||||||
|
<id>{{ metadata.url }}</id>
|
||||||
|
<author>
|
||||||
|
<name>{{ metadata.author.name }}</name>
|
||||||
|
<email>{{ metadata.author.email }}</email>
|
||||||
|
</author>
|
||||||
|
{%- for blog in collections.blogs | reverse %}
|
||||||
|
{%- set absolutePostUrl = blog.url | absoluteUrl(metadata.url) %}
|
||||||
|
<entry>
|
||||||
|
<title>{{ blog.data.title }}</title>
|
||||||
|
<link href="{{ absolutePostUrl }}"/>
|
||||||
|
{# <updated>{{ blog.date | dateToRfc3339 }}</updated> #}
|
||||||
|
<updated>{{ blog.data.date.toUTCString().split(' ').slice(1, 4).join(' ') }}</updated>
|
||||||
|
<id>{{ absolutePostUrl }}</id>
|
||||||
|
<content xml:lang="{{ metadata.language }}" type="html">{{ blog.templateContent | htmlToAbsoluteUrls(absolutePostUrl) }}</content>
|
||||||
|
{# <content xml:lang="{{ metadata.language }}" type="html">{{ blog.templateContent | striptags | truncate(200) }}</content> #}
|
||||||
|
</entry>
|
||||||
|
{%- endfor %}
|
||||||
|
</feed>
|
35
website/src/blogs-rss-feed.njk
Normal file
35
website/src/blogs-rss-feed.njk
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
---
|
||||||
|
permalink: feed.rss
|
||||||
|
eleventyExcludeFromCollections: true
|
||||||
|
metadata:
|
||||||
|
title: SimpleX Chat Blog
|
||||||
|
subtitle: It allows you to stay up to date with the latest Blogs from SimpleX Chat.
|
||||||
|
language: en
|
||||||
|
url: https://simplex.chat/,
|
||||||
|
author:
|
||||||
|
name: SimpleX Chat
|
||||||
|
email: chat@simplex.chat
|
||||||
|
---
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xml:base="{{ metadata.url }}" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||||
|
<channel>
|
||||||
|
<title>{{ metadata.title }}</title>
|
||||||
|
<link>{{ metadata.url }}</link>
|
||||||
|
<atom:link href="{{ permalink | absoluteUrl(metadata.url) }}" rel="self" type="application/rss+xml"/>
|
||||||
|
<description>{{ metadata.subtitle }}</description>
|
||||||
|
<language>{{ metadata.language }}</language>
|
||||||
|
{%- for blog in collections.blogs %}
|
||||||
|
{%- set absolutePostUrl = blog.url | absoluteUrl(metadata.url) %}
|
||||||
|
<item>
|
||||||
|
<title>{{ blog.data.title }}</title>
|
||||||
|
<link>{{ absolutePostUrl }}</link>
|
||||||
|
<description>{{ blog.templateContent | htmlToAbsoluteUrls(absolutePostUrl) }}</description>
|
||||||
|
{# <description>{{ blog.templateContent | striptags | truncate(200) }}</description> #}
|
||||||
|
{# <pubDate>{{ blog.data.date | dateToRfc822 }}</pubDate> #}
|
||||||
|
<pubDate>{{ blog.data.date.toUTCString().split(' ').slice(1, 4).join(' ') }}</pubDate>
|
||||||
|
<dc:creator>{{ metadata.author.name }}</dc:creator>
|
||||||
|
<guid>{{ absolutePostUrl }}</guid>
|
||||||
|
</item>
|
||||||
|
{%- endfor %}
|
||||||
|
</channel>
|
||||||
|
</rss>
|
Loading…
Reference in New Issue
Block a user