From 6d74a54a34b8bebe9c9819dbbb8f24cb35585f0f Mon Sep 17 00:00:00 2001 From: wangb Date: Sat, 8 Oct 2022 11:55:25 +0800 Subject: [PATCH 1/2] update --- src/sitemap.xml.njk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/sitemap.xml.njk b/src/sitemap.xml.njk index 62b1493..a816a57 100644 --- a/src/sitemap.xml.njk +++ b/src/sitemap.xml.njk @@ -3,7 +3,9 @@ {%- for page in search.pages() %} {{ page.data.url | url(true) }} - {{ page.data.date | date("DATE") }} + {% if page.data.date %} + {{ page.data.date | date("DATE") }} + {% endif %} {%- endfor %} From b3cf5adce9b203c5118269ace442b9c77e3a6999 Mon Sep 17 00:00:00 2001 From: wangb Date: Sun, 9 Oct 2022 17:37:08 +0800 Subject: [PATCH 2/2] update: use sitemap plugin from experimental-plugins --- mod.ts | 2 -- plugins.ts | 2 ++ src/robots.txt.njk | 3 --- src/sitemap.xml.njk | 11 ----------- 4 files changed, 2 insertions(+), 16 deletions(-) delete mode 100644 src/robots.txt.njk delete mode 100644 src/sitemap.xml.njk diff --git a/mod.ts b/mod.ts index 2a091e5..324de9f 100644 --- a/mod.ts +++ b/mod.ts @@ -35,8 +35,6 @@ export default function () { "feed.tmpl.js", "feed.xml.njk", "index.njk", - "robots.txt.njk", - "sitemap.xml.njk", "styles.css", "favicon.png", ]; diff --git a/plugins.ts b/plugins.ts index 02d53b2..dfa4794 100644 --- a/plugins.ts +++ b/plugins.ts @@ -7,6 +7,7 @@ import slugifyUrls from "lume/plugins/slugify_urls.ts"; import resolveUrls from "lume/plugins/resolve_urls.ts"; import metas from "lume/plugins/metas.ts"; import pagefind from "lume/plugins/pagefind.ts"; +import sitemap from "https://raw.githubusercontent.com/lumeland/experimental-plugins/b75edba434ab80d0b9033233f6ade19c09825eb7/sitemap/sitemap.ts"; import type { Page, Site } from "lume/core.ts"; @@ -22,6 +23,7 @@ export default function () { .use(slugifyUrls()) .use(pagefind()) .use(terser()) + .use(sitemap()) .copy("fonts") .copy("favicon.png") .preprocess([".md"], (page: Page) => { diff --git a/src/robots.txt.njk b/src/robots.txt.njk deleted file mode 100644 index 40531ed..0000000 --- a/src/robots.txt.njk +++ /dev/null @@ -1,3 +0,0 @@ -User-agent: * - -Sitemap: {{ 'sitemap.xml' | url(true) }} diff --git a/src/sitemap.xml.njk b/src/sitemap.xml.njk deleted file mode 100644 index a816a57..0000000 --- a/src/sitemap.xml.njk +++ /dev/null @@ -1,11 +0,0 @@ - - -{%- for page in search.pages() %} - - {{ page.data.url | url(true) }} - {% if page.data.date %} - {{ page.data.date | date("DATE") }} - {% endif %} - -{%- endfor %} -