1
0
Fork 0
mirror of https://github.com/GuerillaStudio/vanillalist.git synced 2024-10-22 09:27:30 +00:00

Add RSS Feed

This commit is contained in:
Tixie 2022-06-04 21:15:09 +02:00
parent a7060a8d54
commit 2fc34efafa
7 changed files with 1423 additions and 1226 deletions

View file

@ -2,9 +2,18 @@ const glob = require("glob-promise")
const fs = require("fs/promises")
const { URL } = require("url")
const sharpPlugin = require("eleventy-plugin-sharp")
const pluginRss = require("@11ty/eleventy-plugin-rss");
module.exports = function (eleventyConfig) {
eleventyConfig.addGlobalData('generated', () => {
let now = new Date();
return new Intl.DateTimeFormat(
'en-US', { dateStyle: 'full', timeStyle: 'long' }
).format(now);
});
eleventyConfig.setBrowserSyncConfig({ port: 1312 })
eleventyConfig.addPlugin(sharpPlugin(
{
@ -43,13 +52,14 @@ module.exports = function (eleventyConfig) {
});
// eleventyConfig.addPassthroughCopy("./src/js/")
eleventyConfig.addPassthroughCopy({ "./src/static/": "/"})
eleventyConfig.addWatchTarget("./src/sass/")
// eleventyConfig.addWatchTarget("./src/js/")
eleventyConfig.addWatchTarget("./src/static/")
// RSS
eleventyConfig.addPlugin(pluginRss);
return {
dir: {
input: "src",

2588
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -14,7 +14,6 @@
"build": "npm-run-all build:sass build:eleventy"
},
"dependencies": {
"@11ty/eleventy": "^1.0.0",
"@orchidjs/sifter": "^0.9.0",
"autoprefixer": "^10.4.2",
"cross-env": "^7.0.3",
@ -29,6 +28,8 @@
"not dead"
],
"devDependencies": {
"@11ty/eleventy": "^1.0.1",
"@11ty/eleventy-plugin-rss": "^1.1.2",
"@stanzilla/stylelint-config-rational-order": "^0.1.3",
"glob": "^7.2.0",
"glob-promise": "^4.2.2",

View file

@ -9,5 +9,5 @@
</div>
<footer class="footer container">
Copyleft ∴ <a href="https://glitch.family">Glitch.Family</a> — This project is <a href="https://github.com/GlitchFamily/vanillalist" rel="noopener">open-source</a> but the plugin's visuals belong to their respective owners
Copyleft ∴ <a href="https://glitch.family">Glitch.Family</a> — This project is <a href="https://github.com/GlitchFamily/vanillalist" rel="noopener">open-source</a> but the plugin's visuals belong to their respective owners — <a href="{{ '/feed.xml' | url }}">RSS feed</a>
</footer>

View file

@ -10,10 +10,11 @@
pagination %}
</title>
<meta name="description" content="{{ description or site.description }}">
<link rel="canonical" href="{% include 'canonical.njk' | url %}"/>
<meta name="generator" content="Eleventy">
<link rel="canonical" href="{% include 'canonical.njk' | url %}"/>
{% include 'favicons.njk' %}
<link rel="stylesheet" href="{{ '/css/style.css' | url }}"/>
<link rel="alternate" type="application/rss+xml" href="{{ '/feed.xml' | url }}" title="{{ site.name }}" />
{% block head %}{% endblock %}
</head>
<body>

View file

@ -8,7 +8,7 @@ class PluginSearch {
this.cardGenerator = window.vanillalistCard
this.searchEntry = new URLSearchParams(document.location.search.substring(1)).get('s')
this.sifterOptions = {
fields: ['title', 'description'],
fields: ['title', 'description', 'id'],
filter: true
}

35
src/rss.njk Normal file
View file

@ -0,0 +1,35 @@
---json
{
"permalink": "feed.xml",
"eleventyExcludeFromCollections": true
}
---
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>{{ site.name }}</title>
<subtitle>{{ site.description }}</subtitle>
<link href="{{ '/feed.xml' | absoluteUrl(site.baseUrl) }}" rel="self"/>
<link href="{{ '/' | absoluteUrl(site.baseUrl) }}"/>
<id>{{ '/' | absoluteUrl(site.baseUrl) }}</id>
{%- for plugin in collections.plugins %}
<entry>
<title>{{ plugin.title }}</title>
<link href="{{ '/search/' | absoluteUrl(site.baseUrl) }}?s={{ plugin.id }}"/>
<id>{{ '/search/' | absoluteUrl(site.baseUrl) }}?s={{ plugin.id }}</id>
<content type="html">
<p>{{ plugin.description }}</p>
<ul>
{% if plugin.url_demo %}
<li><a href="{{ plugin.url_demo }}">Demo link</a></li>
{% endif %}
{% if plugin.url_github %}
<li><a href="{{ plugin.url_github }}">Github link</a></li>
{% endif %}
{% if plugin.url_nom %}
<li><a href="{{ plugin.url_nom }}">npm link</a></li>
{% endif %}
</ul>
</content>
</entry>
{%- endfor %}
</feed>