Fix reload with taxonomies

This commit is contained in:
Vincent Prouillet 2018-11-16 23:51:11 +01:00
parent e2c3bb2ce2
commit aee41f279c
4 changed files with 18 additions and 4 deletions

View file

@ -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

View file

@ -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()

View file

@ -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

View file

@ -2,6 +2,9 @@
title = "first"
weight = 10
date = 2017-01-01
[taxonomies]
categories = ["a-category"]
+++
# A title