From 08dd5f67d037314941c793d612c7dd54e6df2079 Mon Sep 17 00:00:00 2001 From: Mathias Bynens Date: Sat, 22 Sep 2018 22:45:57 -0400 Subject: [PATCH 1/3] Add code snippet with 2 consecutive new lines This demonstrates the issue that https://github.com/11ty/eleventy-plugin-syntaxhighlight/pull/5 fixes, and could serve as kind of a regression test for the fix. :) --- posts/firstpost.md | 3 +++ posts/thirdpost.md | 3 +++ 2 files changed, 6 insertions(+) diff --git a/posts/firstpost.md b/posts/firstpost.md index 55f3af9..8bd3e44 100644 --- a/posts/firstpost.md +++ b/posts/firstpost.md @@ -19,4 +19,7 @@ function myCommand() { let counter = 0; counter++; } + +// Test with a line break above this line. +console.log('Test'); ``` diff --git a/posts/thirdpost.md b/posts/thirdpost.md index d128384..cae99a4 100644 --- a/posts/thirdpost.md +++ b/posts/thirdpost.md @@ -13,6 +13,9 @@ function myCommand() { let counter = 0; counter++; } + +// Test with a line break above this line. +console.log('Test'); ``` Bring to the table win-win survival strategies to ensure proactive domination. At the end of the day, going forward, a new normal that has evolved from generation X is on the runway heading towards a streamlined cloud solution. User generated content in real-time will have multiple touchpoints for offshoring. From 096ff9f3deeab3b393a496a202f1353f16f81572 Mon Sep 17 00:00:00 2001 From: Mathias Bynens Date: Mon, 24 Sep 2018 15:09:15 -0400 Subject: [PATCH 2/3] Add sitemap.xml --- .eleventy.js | 5 +++++ 404.md | 1 + feed/feed.njk | 3 ++- feed/htaccess.njk | 3 ++- sitemap.xml.njk | 16 ++++++++++++++++ 5 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 sitemap.xml.njk diff --git a/.eleventy.js b/.eleventy.js index b387b3c..9d6487d 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -12,6 +12,11 @@ module.exports = function(eleventyConfig) { return DateTime.fromJSDate(dateObj).toFormat("dd LLL yyyy"); }); + // https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-date-string + eleventyConfig.addFilter('htmlDateString', (dateObj) => { + return DateTime.fromJSDate(dateObj).toFormat('yyyy-LL-dd'); + }); + // only content in the `posts/` directory eleventyConfig.addCollection("posts", function(collection) { return collection.getAllSorted().filter(function(item) { diff --git a/404.md b/404.md index a5465e4..c3d1080 100644 --- a/404.md +++ b/404.md @@ -1,6 +1,7 @@ --- layout: layouts/home.njk permalink: 404.html +excludeFromSitemap: true --- # Content not found. diff --git a/feed/feed.njk b/feed/feed.njk index 636c9c2..f889671 100644 --- a/feed/feed.njk +++ b/feed/feed.njk @@ -1,5 +1,6 @@ --- permalink: feed/feed.xml +excludeFromSitemap: true --- @@ -23,4 +24,4 @@ permalink: feed/feed.xml {{ post.templateContent | htmlToAbsoluteUrls(absolutePostUrl) }} {%- endfor %} - \ No newline at end of file + diff --git a/feed/htaccess.njk b/feed/htaccess.njk index 3318d60..8b4e0d9 100644 --- a/feed/htaccess.njk +++ b/feed/htaccess.njk @@ -1,5 +1,6 @@ --- permalink: feed/.htaccess +excludeFromSitemap: true --- # For Apache, to show `{{ metadata.feed.filename }}` when browsing to directory /feed/ (hide the file!) -DirectoryIndex {{ metadata.feed.filename }} \ No newline at end of file +DirectoryIndex {{ metadata.feed.filename }} diff --git a/sitemap.xml.njk b/sitemap.xml.njk new file mode 100644 index 0000000..d1745a3 --- /dev/null +++ b/sitemap.xml.njk @@ -0,0 +1,16 @@ +--- +permalink: /sitemap.xml +excludeFromSitemap: true +--- + + +{%- for page in collections.all %} +{%- if not page.data.excludeFromSitemap %} + {% set absoluteUrl %}{{ page.url | url | absoluteUrl(metadata.url) }}{% endset %} + + {{ absoluteUrl }} + {{ page.date | htmlDateString }} + +{%- endif %} +{%- endfor %} + From b710903da867e8c8e6427ff1b86fd6db5a32f9e7 Mon Sep 17 00:00:00 2001 From: Mathias Bynens Date: Thu, 27 Sep 2018 20:55:45 -0400 Subject: [PATCH 3/3] Use