@@ -6,6 +6,7 @@ | |||||
- Fix pagination for taxonomies being broken and add missing documentation for it | - Fix pagination for taxonomies being broken and add missing documentation for it | ||||
- Add missing pager pages from the sitemap | - Add missing pager pages from the sitemap | ||||
- Allow and parse full RFC339 datetimes in filenames | - Allow and parse full RFC339 datetimes in filenames | ||||
- Live reload is now enabled for the 404 page on serve | |||||
## 0.5.0 (2018-11-17) | ## 0.5.0 (2018-11-17) | ||||
@@ -1,6 +1,6 @@ | |||||
[package] | [package] | ||||
name = "zola" | name = "zola" | ||||
version = "0.5.0" | |||||
version = "0.5.1" | |||||
authors = ["Vincent Prouillet <prouillet.vincent@gmail.com>"] | authors = ["Vincent Prouillet <prouillet.vincent@gmail.com>"] | ||||
license = "MIT" | license = "MIT" | ||||
readme = "README.md" | readme = "README.md" | ||||
@@ -542,7 +542,6 @@ Hello world | |||||
assert_eq!(page.slug, "hello"); | assert_eq!(page.slug, "hello"); | ||||
} | } | ||||
#[test] | #[test] | ||||
fn frontmatter_date_override_filename_date() { | fn frontmatter_date_override_filename_date() { | ||||
let config = Config::default(); | let config = Config::default(); | ||||
@@ -628,10 +628,7 @@ impl Site { | |||||
let mut context = Context::new(); | let mut context = Context::new(); | ||||
context.insert("config", &self.config); | context.insert("config", &self.config); | ||||
let output = render_template("404.html", &self.tera, &context, &self.config.theme)?; | let output = render_template("404.html", &self.tera, &context, &self.config.theme)?; | ||||
create_file( | |||||
&self.output_path.join("404.html"), | |||||
&self.inject_livereload(output), | |||||
) | |||||
create_file(&self.output_path.join("404.html"), &self.inject_livereload(output)) | |||||
} | } | ||||
/// Renders robots.txt | /// Renders robots.txt | ||||
@@ -722,10 +719,15 @@ impl Site { | |||||
.iter() | .iter() | ||||
.map(|s| SitemapEntry::new(s.permalink.clone(), None)) | .map(|s| SitemapEntry::new(s.permalink.clone(), None)) | ||||
.collect::<Vec<_>>(); | .collect::<Vec<_>>(); | ||||
for section in self.library.sections_values().iter().filter(|s| s.meta.paginate_by.is_some()) { | |||||
let number_pagers = (section.pages.len() as f64 / section.meta.paginate_by.unwrap() as f64).ceil() as isize; | |||||
for i in 1..number_pagers+1 { | |||||
let permalink = format!("{}{}/{}/", section.permalink, section.meta.paginate_path, i); | |||||
for section in | |||||
self.library.sections_values().iter().filter(|s| s.meta.paginate_by.is_some()) | |||||
{ | |||||
let number_pagers = (section.pages.len() as f64 | |||||
/ section.meta.paginate_by.unwrap() as f64) | |||||
.ceil() as isize; | |||||
for i in 1..number_pagers + 1 { | |||||
let permalink = | |||||
format!("{}{}/{}/", section.permalink, section.meta.paginate_path, i); | |||||
sections.push(SitemapEntry::new(permalink, None)) | sections.push(SitemapEntry::new(permalink, None)) | ||||
} | } | ||||
} | } | ||||
@@ -744,9 +746,17 @@ impl Site { | |||||
)); | )); | ||||
if taxonomy.kind.is_paginated() { | if taxonomy.kind.is_paginated() { | ||||
let number_pagers = (item.pages.len() as f64 / taxonomy.kind.paginate_by.unwrap() as f64).ceil() as isize; | |||||
for i in 1..number_pagers+1 { | |||||
let permalink = self.config.make_permalink(&format!("{}/{}/{}/{}", name, item.slug, taxonomy.kind.paginate_path(), i)); | |||||
let number_pagers = (item.pages.len() as f64 | |||||
/ taxonomy.kind.paginate_by.unwrap() as f64) | |||||
.ceil() as isize; | |||||
for i in 1..number_pagers + 1 { | |||||
let permalink = self.config.make_permalink(&format!( | |||||
"{}/{}/{}/{}", | |||||
name, | |||||
item.slug, | |||||
taxonomy.kind.paginate_path(), | |||||
i | |||||
)); | |||||
terms.push(SitemapEntry::new(permalink, None)) | terms.push(SitemapEntry::new(permalink, None)) | ||||
} | } | ||||
} | } | ||||
@@ -417,11 +417,11 @@ mod tests { | |||||
assert_eq!( | assert_eq!( | ||||
result, | result, | ||||
json!({ | json!({ | ||||
"category": { | |||||
"date": "1979-05-27T07:32:00Z", | |||||
"key": "value" | |||||
}, | |||||
}) | |||||
"category": { | |||||
"date": "1979-05-27T07:32:00Z", | |||||
"key": "value" | |||||
}, | |||||
}) | |||||
); | ); | ||||
} | } | ||||
@@ -438,12 +438,12 @@ mod tests { | |||||
assert_eq!( | assert_eq!( | ||||
result, | result, | ||||
json!({ | json!({ | ||||
"headers": ["Number", "Title"], | |||||
"records": [ | |||||
["1", "Gutenberg"], | |||||
["2", "Printing"] | |||||
], | |||||
}) | |||||
"headers": ["Number", "Title"], | |||||
"records": [ | |||||
["1", "Gutenberg"], | |||||
["2", "Printing"] | |||||
], | |||||
}) | |||||
) | ) | ||||
} | } | ||||
@@ -460,12 +460,12 @@ mod tests { | |||||
assert_eq!( | assert_eq!( | ||||
result, | result, | ||||
json!({ | json!({ | ||||
"key": "value", | |||||
"array": [1, 2, 3], | |||||
"subpackage": { | |||||
"subkey": 5 | |||||
} | |||||
}) | |||||
"key": "value", | |||||
"array": [1, 2, 3], | |||||
"subpackage": { | |||||
"subkey": 5 | |||||
} | |||||
}) | |||||
) | ) | ||||
} | } | ||||
} | } |
@@ -144,7 +144,7 @@ pub fn make_get_taxonomy(all_taxonomies: &[Taxonomy], library: &Library) -> Glob | |||||
None => { | None => { | ||||
return Err( | return Err( | ||||
format!("`get_taxonomy` received an unknown taxonomy as kind: {}", kind).into() | format!("`get_taxonomy` received an unknown taxonomy as kind: {}", kind).into() | ||||
) | |||||
); | |||||
} | } | ||||
}; | }; | ||||
@@ -180,7 +180,7 @@ pub fn make_get_taxonomy_url(all_taxonomies: &[Taxonomy]) -> GlobalFn { | |||||
"`get_taxonomy_url` received an unknown taxonomy as kind: {}", | "`get_taxonomy_url` received an unknown taxonomy as kind: {}", | ||||
kind | kind | ||||
) | ) | ||||
.into()) | |||||
.into()); | |||||
} | } | ||||
}; | }; | ||||