Last active
January 23, 2023 10:49
-
-
Save freshyill/09324b479db853dbeb1329e855a1a57e to your computer and use it in GitHub Desktop.
Revisions
-
freshyill revised this gist
Apr 3, 2019 . 1 changed file with 15 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ const pluginRss = require("@11ty/eleventy-plugin-rss"); module.exports = function(eleventyConfig) { // Lots of other stuff probably goes here eleventyConfig.addCollection("allUpdates", function(collection) { return collection.getFilteredByGlob(["posts/*.md", "photos/*.md", "notes/*.md"]).sort(function(a, b) { return b.date - a.date; }); }); // Lots of other stuff probably goes here } -
freshyill created this gist
Apr 3, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,83 @@ --- permalink: feed.json metadata: title: My Site Title url: https://my.url author: name: My Name email: [email protected] avatar: /path/to/pic.jpg feed: subtitle: My feed subtitle filename: feed.json path: feed/feed.json url: https://my.url/feed.json id: https://my.url --- { "version": "https://jsonfeed.org/version/1", "title": "{{ metadata.title }}", "home_page_url": "{{ metadata.url }}", "feed_url": "{{ metadata.url }}/feed.json", "favicon": "{{ metadata.url }}/static/img/icon.png", "icon": "{{ metadata.url }}/static/img/icon.png", "description": "{{ metadata.feed.subtitle }}", "author": { "name": "{{ metadata.author.name }}", "url": "{{ metadata.url }}", "avatar": "{{ metadata.url }}{{ metadata.author.avatar }}" }, "items": [ {% set comma = joiner(",") -%} {%- for post in collections.allUpdates -%} {%- set absolutePostUrl -%}{{ post.url | url | absoluteUrl(metadata.url) }}{%- endset -%} {%- set title -%}{{ post.data.title }}{%- endset -%} {%- set banner -%}{{ post.data.hero.image }}{%- endset -%} {%- set summary -%}{{ post.data.summary }}{%- endset -%} {%- set heroimg -%}{{ post.data.hero.image }}{%- endset -%} {%- set herocap -%}{{ post.data.hero.caption }}{%- endset -%} {%- set reg1 = "\"" -%} {%- set rep1 %}\"{% endset -%} {%- set reg2 = "\\\\\\" -%} {# Handling one weird edge case! #} {%- set rep2 %}\\\\\\{% endset -%} {%- set reg3 = "\n" -%} {%- set rep3 %}\n{% endset -%} {%- set reg4 = "\r" -%} {%- set rep4 %}\r{% endset -%} {%- set reg5 = "\t" -%} {%- set rep5 %}\t{% endset -%} {{- comma() }} { "id": "{{ absolutePostUrl }}", "content_html": "{%- if heroimg -%}<figure><img src=\"{{ heroimg | url | absoluteUrl(metadata.url) }}\" alt=\"{{ herocap }}\"><figcaption>{{ herocap }}</figcaption></figure>{%- endif -%}{{- post.templateContent | htmlToAbsoluteUrls(absolutePostUrl) | replace(reg1, rep1) | replace(reg2, rep2) | replace(reg3, rep3) | replace(reg4, rep4) | replace(reg5, rep5) | safe -}}", "url": "{{ absolutePostUrl }}", "date_published": "{{ post.date | rfc3339 }}" {%- if summary %}, "summary": "{{ post.data.summary }}" {% endif -%} {%- if not "note" in post.data.tags %}, "title": "{{ title }}" {% endif -%} {%- if banner %}, "banner_image": "{{ metadata.url }}{{ banner }}" {% endif -%}, "author": { "name": " {{ metadata.author.name }}", "url": "{{ metadata.url }}", "avatar": "{{ metadata.author.avatar | url | absoluteUrl(metadata.url) }}" }, } {% endfor %} ] }