From 97d11995c51fe25f9129df635956f6e87579d06b Mon Sep 17 00:00:00 2001 From: Vincent Prouillet Date: Thu, 31 Jan 2019 19:55:34 +0100 Subject: [PATCH] Skip render=false sections in sitemap Fix #604 --- CHANGELOG.md | 1 + components/site/src/lib.rs | 1 + components/site/tests/site.rs | 2 ++ 3 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a60d667..cbf56d50 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ a section - Add an id (`zola-continue-reading`) to the paragraph generated after a summary - Add Dracula syntax highlighting theme - Fix using inline styles in headers +- Fix sections with render=false being shown in sitemap ## 0.5.1 (2018-12-14) diff --git a/components/site/src/lib.rs b/components/site/src/lib.rs index 8a8e0b78..94457577 100644 --- a/components/site/src/lib.rs +++ b/components/site/src/lib.rs @@ -797,6 +797,7 @@ impl Site { .read().unwrap() .sections_values() .iter() + .filter(|s| s.meta.render) .map(|s| SitemapEntry::new(s.permalink.clone(), None)) .collect::>(); for section in diff --git a/components/site/tests/site.rs b/components/site/tests/site.rs index 7e025e70..c85033aa 100644 --- a/components/site/tests/site.rs +++ b/components/site/tests/site.rs @@ -175,6 +175,8 @@ fn can_build_site_without_live_reload() { )); // Drafts are not in the sitemap assert!(!file_contains!(public, "sitemap.xml", "draft")); + // render: false sections are not in the sitemap either + assert!(!file_contains!(public, "sitemap.xml", "posts/2018/")); // robots.txt has been rendered from the template assert!(file_contains!(public, "robots.txt", "User-agent: zola"));