Clean up the JSON code a bit (don’t need that extra filter)

This commit is contained in:
Zach Leatherman 2020-07-27 15:02:58 -05:00
parent 2934dae820
commit d3ced37f50
4 changed files with 7 additions and 14 deletions

View File

@ -24,14 +24,6 @@ module.exports = function(eleventyConfig) {
return DateTime.fromJSDate(dateObj, {zone: 'utc'}).toFormat('yyyy-LL-dd');
});
// Content for jsonfeed
eleventyConfig.addFilter('jsonStringify', content => {
if (!content) {
content = "";
}
return JSON.stringify(content);
});
// Get the first `n` elements of a collection.
eleventyConfig.addFilter("head", (array, n) => {
if( n < 0 ) {

View File

@ -1,20 +1,20 @@
{
"title": "Your Blog Name",
"url": "https://myurl.com/",
"url": "https://example.com/",
"description": "I am writing about my experiences as a naval navel-gazer.",
"feed": {
"subtitle": "I am writing about my experiences as a naval navel-gazer.",
"filename": "feed.xml",
"path": "/feed/feed.xml",
"id": "https://myurl.com/"
"id": "https://example.com/"
},
"jsonfeed": {
"path": "/feed/feed.json",
"url": "https://myurl.com/feed/feed.json"
"url": "https://example.com/feed/feed.json"
},
"author": {
"name": "Your Name Here",
"email": "youremailaddress@example.com",
"url": "https://myurl.com/"
"url": "https://example.com/about-me/"
}
}

View File

@ -20,7 +20,7 @@ eleventyExcludeFromCollections: true
"id": "{{ absolutePostUrl }}",
"url": "{{ absolutePostUrl }}",
"title": "{{ post.data.title }}",
"content_html": {{ post.templateContent | jsonStringify | safe }},
"content_html": {% if post.templateContent %}{{ post.templateContent | dump | safe }}{% else %}""{% endif %},
"date_published": "{{ post.date | rssDate }}",
"tags": [
{%- for c in post.data.category %}

View File

@ -6,6 +6,7 @@
"build": "eleventy",
"watch": "eleventy --watch",
"serve": "eleventy --serve",
"start": "eleventy --serve",
"debug": "DEBUG=* eleventy"
},
"repository": {
@ -25,7 +26,7 @@
"devDependencies": {
"@11ty/eleventy": "^0.11.0",
"@11ty/eleventy-navigation": "^0.1.6",
"@11ty/eleventy-plugin-rss": "^1.0.7",
"@11ty/eleventy-plugin-rss": "^1.0.9",
"@11ty/eleventy-plugin-syntaxhighlight": "^3.0.1",
"luxon": "^1.21.3",
"markdown-it": "^8.4.2",