Merge pull request #32 from oddbird/atom

Add Atom feed
This commit is contained in:
Jonny Gerig Meyer 2023-04-07 15:05:01 -04:00 committed by GitHub
commit dd97cc688a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 74 additions and 5 deletions

View File

@ -52,7 +52,7 @@ page '/blog/*', :layout => :blog
for dir in ['docs/yardoc', 'documentation'] do
redirect "#{dir}/file.SASS_REFERENCE.html", to: '/documentation'
redirect "#{dir}/file.SASS_CHANGELOG.html", to: 'https://github.com/sass/dart-sass/blob/master/CHANGELOG.md'
redirect "#{dir}/file.SASS_CHANGELOG.html", to: 'https://github.com/sass/dart-sass/blob/main/CHANGELOG.md'
redirect "#{dir}/file.INDENTED_SYNTAX.html", to: '/documentation/syntax'
redirect "#{dir}/file.SCSS_FOR_SASS_USERS.html", to: '/documentation/syntax'
redirect "#{dir}/Sass/Script/Functions.html", to: '/documentation/modules'

View File

@ -1,6 +1,12 @@
'use strict';
const { EleventyRenderPlugin } = require('@11ty/eleventy');
const {
absoluteUrl,
convertHtmlToAbsoluteUrls,
dateToRfc3339,
getNewestCollectionItemDate,
} = require('@11ty/eleventy-plugin-rss');
const syntaxHighlight = require('@11ty/eleventy-plugin-syntaxhighlight');
const yaml = require('js-yaml');
@ -16,6 +22,7 @@ module.exports = (eleventyConfig) => {
eleventyConfig.addPassthroughCopy('source/assets/dist');
eleventyConfig.addPassthroughCopy('source/assets/img');
eleventyConfig.addPassthroughCopy('source/favicon.ico');
eleventyConfig.addPassthroughCopy('source/_redirects');
eleventyConfig.setUseGitIgnore(false);
eleventyConfig.watchIgnores.add('source/_data/versionCache.json');
@ -32,6 +39,18 @@ module.exports = (eleventyConfig) => {
eleventyConfig.addPlugin(pagesPlugin);
eleventyConfig.addPlugin(typePlugin);
// rss plugin
eleventyConfig.addLiquidFilter('absoluteUrl', absoluteUrl);
eleventyConfig.addLiquidFilter(
'getNewestCollectionItemDate',
getNewestCollectionItemDate,
);
eleventyConfig.addLiquidFilter('dateToRfc3339', dateToRfc3339);
eleventyConfig.addLiquidFilter(
'htmlToAbsoluteUrls',
convertHtmlToAbsoluteUrls,
);
// other plugins
eleventyConfig.addPlugin(EleventyRenderPlugin);
eleventyConfig.addPlugin(syntaxHighlight);

View File

@ -39,6 +39,7 @@
},
"devDependencies": {
"@11ty/eleventy": "^2.0.1",
"@11ty/eleventy-plugin-rss": "^1.2.0",
"@11ty/eleventy-plugin-syntaxhighlight": "^4.2.0",
"@babel/core": "^7.21.4",
"@babel/preset-env": "^7.21.4",

1
source/_data/site.yml Normal file
View File

@ -0,0 +1 @@
url: https://sass-lang.com/

View File

@ -8,7 +8,7 @@
<div class="sl-l-grid__column">
{% markdown %}
Sass &copy; 2006&ndash;{{ 'now' | date: '%Y' }} the Sass team, and numerous contributors.
It is available for use and modification under the [MIT License](https://github.com/sass/dart-sass/blob/master/LICENSE).
It is available for use and modification under the [MIT License](https://github.com/sass/dart-sass/blob/main/LICENSE).
{% endmarkdown %}
{% renderFile 'source/_includes/footer_nav.md' %}

10
source/_redirects Normal file
View File

@ -0,0 +1,10 @@
/feed /feed.xml 200
/tutorial /guide
/download /install
/try https://www.sassmeister.com
/about /
/blog/posts/560719 /blog/dropping-support-for-old-ruby-versions
/blog/posts/1305238 /blog/dart-sass-is-on-chocolatey
/blog/posts/1404451 /blog/sass-and-browser-compatibility
/blog/posts/1909151 /blog/dart-sass-is-in-beta
/blog/posts/7081811 /blog/ruby-sass-is-deprecated

View File

@ -57,5 +57,5 @@ on helping out. Or, if you're interested in helping add new features to the Sass
language, look at [the language contribution process][].
[Dart Sass]: /dart-sass
[contributing info]: https://github.com/sass/dart-sass/blob/master/CONTRIBUTING.md
[the language contribution process]: https://github.com/sass/language/blob/master/CONTRIBUTING.md
[contributing info]: https://github.com/sass/dart-sass/blob/main/CONTRIBUTING.md
[the language contribution process]: https://github.com/sass/sass/blob/main/CONTRIBUTING.md

26
source/feed.liquid Normal file
View File

@ -0,0 +1,26 @@
---
permalink: 'feed.xml'
eleventyExcludeFromCollections: true
---
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Sass Blog</title>
<id>{{ '/blog' | absoluteUrl: site.url }}</id>
<link href="{{ '/blog' | absoluteUrl: site.url }}"/>
<link href="{{ page.url | absoluteUrl: site.url }}" rel="self"/>
<updated>{{ collections.blog | getNewestCollectionItemDate | dateToRfc3339 }}</updated>
{%- assign posts = collections.blog | reverse -%}
{%- for post in posts limit:6 -%}
{%- assign absolutePostUrl = post.url | absoluteUrl: site.url %}
<entry>
<title>{{ post.data.title }}</title>
<link href="{{ absolutePostUrl }}" rel="alternate"/>
<id>{{ absolutePostUrl }}</id>
<published>{{ post.date | dateToRfc3339 }}</published>
<updated>{{ post.data.updated | default: post.date | dateToRfc3339 }}</updated>
<author>
<name>{{ post.data.author }}</name>
</author>
<content type="html">{{ post.templateContent | htmlToAbsoluteUrls: absolutePostUrl | escape }}</content>
</entry>{% endfor %}
</feed>

View File

@ -33,6 +33,17 @@ __metadata:
languageName: node
linkType: hard
"@11ty/eleventy-plugin-rss@npm:^1.2.0":
version: 1.2.0
resolution: "@11ty/eleventy-plugin-rss@npm:1.2.0"
dependencies:
debug: ^4.3.4
posthtml: ^0.16.6
posthtml-urls: 1.0.0
checksum: e122a8483f353fa49ed40dd150c59efbc191e34e868a24ab62aba0ac16b8c1b2904c1c79fd717eea2286a98a68c3910221637fe5fdaa61ffcb66f34912a191ec
languageName: node
linkType: hard
"@11ty/eleventy-plugin-syntaxhighlight@npm:^4.2.0":
version: 4.2.0
resolution: "@11ty/eleventy-plugin-syntaxhighlight@npm:4.2.0"
@ -6289,7 +6300,7 @@ __metadata:
languageName: node
linkType: hard
"posthtml-urls@npm:^1.0.0":
"posthtml-urls@npm:1.0.0, posthtml-urls@npm:^1.0.0":
version: 1.0.0
resolution: "posthtml-urls@npm:1.0.0"
dependencies:
@ -6818,6 +6829,7 @@ __metadata:
resolution: "sass-site@workspace:."
dependencies:
"@11ty/eleventy": ^2.0.1
"@11ty/eleventy-plugin-rss": ^1.2.0
"@11ty/eleventy-plugin-syntaxhighlight": ^4.2.0
"@babel/core": ^7.21.4
"@babel/preset-env": ^7.21.4