From 12e1a9171c06decbca1bcf371cc17ff633f6b15f Mon Sep 17 00:00:00 2001 From: Jonny Gerig Meyer Date: Tue, 4 Apr 2023 14:22:44 -0400 Subject: [PATCH 1/7] Add Atom feed --- eleventy.config.js | 18 ++++++++++++++++++ package.json | 1 + source/_data/site.yml | 1 + source/feed.liquid | 26 ++++++++++++++++++++++++++ yarn.lock | 14 +++++++++++++- 5 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 source/_data/site.yml create mode 100644 source/feed.liquid diff --git a/eleventy.config.js b/eleventy.config.js index a665a51..53088e8 100644 --- a/eleventy.config.js +++ b/eleventy.config.js @@ -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'); @@ -32,6 +38,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); diff --git a/package.json b/package.json index 66151f4..1d9330f 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/source/_data/site.yml b/source/_data/site.yml new file mode 100644 index 0000000..612f877 --- /dev/null +++ b/source/_data/site.yml @@ -0,0 +1 @@ +url: https://sass-lang.com/ diff --git a/source/feed.liquid b/source/feed.liquid new file mode 100644 index 0000000..de63e67 --- /dev/null +++ b/source/feed.liquid @@ -0,0 +1,26 @@ +--- +permalink: 'feed.xml' +eleventyExcludeFromCollections: true +--- + + + Sass Blog + {{ '/blog' | absoluteUrl: site.url }} + + + {{ collections.blog | getNewestCollectionItemDate | dateToRfc3339 }} + {%- assign posts = collections.blog | reverse -%} + {%- for post in posts limit:6 %} + {%- assign absolutePostUrl = post.url | absoluteUrl: site.url -%} + + {{ post.data.title }} + + {{ absolutePostUrl }} + {{ post.date | dateToRfc3339 }} + + {{ post.data.author }} + + {{ post.templateContent | htmlToAbsoluteUrls: absolutePostUrl | escape }} + + {% endfor -%} + diff --git a/yarn.lock b/yarn.lock index 537a3aa..d1c811e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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 From 72721bb0259e03553aabd7a0484fec5b23cc7ef6 Mon Sep 17 00:00:00 2001 From: Jonny Gerig Meyer Date: Tue, 4 Apr 2023 17:56:36 -0400 Subject: [PATCH 2/7] Serve atom feed at /feed and /feed.xml --- source/feed.liquid | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/source/feed.liquid b/source/feed.liquid index de63e67..80ad849 100644 --- a/source/feed.liquid +++ b/source/feed.liquid @@ -1,5 +1,12 @@ --- -permalink: 'feed.xml' +pagination: + data: urls + alias: url + size: 1 +urls: + - 'feed.xml' + - 'feed' +permalink: '{{ url }}' eleventyExcludeFromCollections: true --- @@ -7,7 +14,7 @@ eleventyExcludeFromCollections: true Sass Blog {{ '/blog' | absoluteUrl: site.url }} - + {{ collections.blog | getNewestCollectionItemDate | dateToRfc3339 }} {%- assign posts = collections.blog | reverse -%} {%- for post in posts limit:6 %} @@ -17,6 +24,7 @@ eleventyExcludeFromCollections: true {{ absolutePostUrl }} {{ post.date | dateToRfc3339 }} + {{ post.date | dateToRfc3339 }} {{ post.data.author }} From fa68a8437072afedefa4144f4c85b6680eb8f24f Mon Sep 17 00:00:00 2001 From: Jonny Gerig Meyer Date: Tue, 4 Apr 2023 18:05:24 -0400 Subject: [PATCH 3/7] Use blog `updated` if exists --- source/feed.liquid | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/feed.liquid b/source/feed.liquid index 80ad849..a10e6f3 100644 --- a/source/feed.liquid +++ b/source/feed.liquid @@ -24,7 +24,7 @@ eleventyExcludeFromCollections: true {{ absolutePostUrl }} {{ post.date | dateToRfc3339 }} - {{ post.date | dateToRfc3339 }} + {{ post.data.updated | default: post.date | dateToRfc3339 }} {{ post.data.author }} From 7128de47eaea33ee18b3a27c5c048c6f3d491d68 Mon Sep 17 00:00:00 2001 From: Jonny Gerig Meyer Date: Wed, 5 Apr 2023 10:54:46 -0400 Subject: [PATCH 4/7] try netlify redirects --- eleventy.config.js | 1 + source/_redirects | 10 ++++++++++ source/feed.liquid | 11 ++--------- 3 files changed, 13 insertions(+), 9 deletions(-) create mode 100644 source/_redirects diff --git a/eleventy.config.js b/eleventy.config.js index 53088e8..b607f5b 100644 --- a/eleventy.config.js +++ b/eleventy.config.js @@ -22,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'); diff --git a/source/_redirects b/source/_redirects new file mode 100644 index 0000000..746526a --- /dev/null +++ b/source/_redirects @@ -0,0 +1,10 @@ +/feed /feed.xml +/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 diff --git a/source/feed.liquid b/source/feed.liquid index a10e6f3..013718f 100644 --- a/source/feed.liquid +++ b/source/feed.liquid @@ -1,12 +1,5 @@ --- -pagination: - data: urls - alias: url - size: 1 -urls: - - 'feed.xml' - - 'feed' -permalink: '{{ url }}' +permalink: 'feed.xml' eleventyExcludeFromCollections: true --- @@ -14,7 +7,7 @@ eleventyExcludeFromCollections: true Sass Blog {{ '/blog' | absoluteUrl: site.url }} - + {{ collections.blog | getNewestCollectionItemDate | dateToRfc3339 }} {%- assign posts = collections.blog | reverse -%} {%- for post in posts limit:6 %} From 79c91b7581b156b0144bc19dce1d660fb55e7d4c Mon Sep 17 00:00:00 2001 From: Jonny Gerig Meyer Date: Wed, 5 Apr 2023 11:03:44 -0400 Subject: [PATCH 5/7] Use rewrite for /feed --- source/_redirects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/_redirects b/source/_redirects index 746526a..323d191 100644 --- a/source/_redirects +++ b/source/_redirects @@ -1,4 +1,4 @@ -/feed /feed.xml +/feed /feed.xml 200 /tutorial /guide /download /install /try https://www.sassmeister.com From 2548efea4278ad41b8ada0d325e6e6fb5ea9c73b Mon Sep 17 00:00:00 2001 From: Jonny Gerig Meyer Date: Wed, 5 Apr 2023 11:16:35 -0400 Subject: [PATCH 6/7] fix urls --- config.rb | 2 +- source/_includes/footer.liquid | 2 +- source/community.md | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config.rb b/config.rb index cdcf1be..2df96e0 100644 --- a/config.rb +++ b/config.rb @@ -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' diff --git a/source/_includes/footer.liquid b/source/_includes/footer.liquid index 5678723..e811b3a 100644 --- a/source/_includes/footer.liquid +++ b/source/_includes/footer.liquid @@ -8,7 +8,7 @@
{% markdown %} Sass © 2006–{{ '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' %} diff --git a/source/community.md b/source/community.md index e15502d..7ca809b 100644 --- a/source/community.md +++ b/source/community.md @@ -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 From b95ecb2e818ec63d19d7b3768c5cec5e065fa44b Mon Sep 17 00:00:00 2001 From: Jonny Gerig Meyer Date: Thu, 6 Apr 2023 11:54:48 -0400 Subject: [PATCH 7/7] whitespace in feed --- source/feed.liquid | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/source/feed.liquid b/source/feed.liquid index 013718f..062974d 100644 --- a/source/feed.liquid +++ b/source/feed.liquid @@ -10,8 +10,8 @@ eleventyExcludeFromCollections: true {{ collections.blog | getNewestCollectionItemDate | dateToRfc3339 }} {%- assign posts = collections.blog | reverse -%} - {%- for post in posts limit:6 %} - {%- assign absolutePostUrl = post.url | absoluteUrl: site.url -%} + {%- for post in posts limit:6 -%} + {%- assign absolutePostUrl = post.url | absoluteUrl: site.url %} {{ post.data.title }} @@ -22,6 +22,5 @@ eleventyExcludeFromCollections: true {{ post.data.author }} {{ post.templateContent | htmlToAbsoluteUrls: absolutePostUrl | escape }} - - {% endfor -%} + {% endfor %}