Skip render=false sections in sitemap

Fix #604
This commit is contained in:
Vincent Prouillet 2019-01-31 19:55:34 +01:00
parent 776bf41123
commit 97d11995c5
3 changed files with 4 additions and 0 deletions

View File

@ -13,6 +13,7 @@ a section
- Add an id (`zola-continue-reading`) to the paragraph generated after a summary - Add an id (`zola-continue-reading`) to the paragraph generated after a summary
- Add Dracula syntax highlighting theme - Add Dracula syntax highlighting theme
- Fix using inline styles in headers - Fix using inline styles in headers
- Fix sections with render=false being shown in sitemap
## 0.5.1 (2018-12-14) ## 0.5.1 (2018-12-14)

View File

@ -797,6 +797,7 @@ impl Site {
.read().unwrap() .read().unwrap()
.sections_values() .sections_values()
.iter() .iter()
.filter(|s| s.meta.render)
.map(|s| SitemapEntry::new(s.permalink.clone(), None)) .map(|s| SitemapEntry::new(s.permalink.clone(), None))
.collect::<Vec<_>>(); .collect::<Vec<_>>();
for section in for section in

View File

@ -175,6 +175,8 @@ fn can_build_site_without_live_reload() {
)); ));
// Drafts are not in the sitemap // Drafts are not in the sitemap
assert!(!file_contains!(public, "sitemap.xml", "draft")); assert!(!file_contains!(public, "sitemap.xml", "draft"));
// render: false sections are not in the sitemap either
assert!(!file_contains!(public, "sitemap.xml", "posts/2018/</loc>"));
// robots.txt has been rendered from the template // robots.txt has been rendered from the template
assert!(file_contains!(public, "robots.txt", "User-agent: zola")); assert!(file_contains!(public, "robots.txt", "User-agent: zola"));