diff --git a/CHANGELOG.md b/CHANGELOG.md index 54e379fc..e8024af0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ Tera function - Table of content now strips HTML from the titles to avoid various issues - `gutenberg-anchor` CSS class has been renamed `zola-anchor` +- `data` is now a reserved variable name in templates, it is unused right now but +might change soon. ### Others - Many many times faster (x5-x40) for most sites diff --git a/components/rebuild/src/lib.rs b/components/rebuild/src/lib.rs index 7b6d3a16..454e2c57 100644 --- a/components/rebuild/src/lib.rs +++ b/components/rebuild/src/lib.rs @@ -118,6 +118,7 @@ fn delete_element(site: &mut Site, path: &Path, is_section: bool) -> Result<()> } site.populate_sections(); + site.populate_taxonomies()?; // Ensure we have our fn updated so it doesn't contain the permalink(s)/section/page deleted site.register_early_global_fns(); site.register_tera_global_fns(); @@ -190,6 +191,7 @@ fn handle_page_editing(site: &mut Site, path: &Path) -> Result<()> { // Updating a page Some(prev) => { site.populate_sections(); + site.populate_taxonomies()?; // Front matter didn't change, only content did if site.library.get_page(&pathbuf).unwrap().meta == prev.meta { @@ -362,6 +364,7 @@ pub fn after_template_change(site: &mut Site, path: &Path) -> Result<()> { site.render_markdown()?; } site.populate_sections(); + site.populate_taxonomies()?; site.render_sections()?; site.render_orphan_pages()?; site.render_taxonomies() diff --git a/components/site/tests/site.rs b/components/site/tests/site.rs index d04113af..431bb50d 100644 --- a/components/site/tests/site.rs +++ b/components/site/tests/site.rs @@ -169,8 +169,11 @@ fn can_build_site_without_live_reload() { assert!(file_exists!(public, "posts/tutorials/devops/index.html")); assert!(file_contains!(public, "posts/tutorials/devops/index.html", "docker")); - // No tags or categories - assert_eq!(file_exists!(public, "categories/index.html"), false); + // We do have categories + assert_eq!(file_exists!(public, "categories/index.html"), true); + assert_eq!(file_exists!(public, "categories/a-category/index.html"), true); + assert_eq!(file_exists!(public, "categories/a-category/rss.xml"), true); + // But no tags assert_eq!(file_exists!(public, "tags/index.html"), false); // Theme files are there @@ -245,8 +248,11 @@ fn can_build_site_with_live_reload() { assert!(file_exists!(public, "posts/tutorials/programming/index.html")); // TODO: add assertion for syntax highlighting - // No tags or categories - assert_eq!(file_exists!(public, "categories/index.html"), false); + // We do have categories + assert_eq!(file_exists!(public, "categories/index.html"), true); + assert_eq!(file_exists!(public, "categories/a-category/index.html"), true); + assert_eq!(file_exists!(public, "categories/a-category/rss.xml"), true); + // But no tags assert_eq!(file_exists!(public, "tags/index.html"), false); // no live reload code diff --git a/test_site/content/rebuild/first.md b/test_site/content/rebuild/first.md index 213fa4bb..708e286e 100644 --- a/test_site/content/rebuild/first.md +++ b/test_site/content/rebuild/first.md @@ -2,6 +2,9 @@ title = "first" weight = 10 date = 2017-01-01 + +[taxonomies] +categories = ["a-category"] +++ # A title