Name the index section

This commit is contained in:
Vincent Prouillet 2017-06-19 18:14:13 +09:00
parent 77ad6547e5
commit 6508b7e4d3
2 changed files with 4 additions and 1 deletions

View file

@ -9,6 +9,7 @@
- Add `section` to a page Tera context if there is one
- Add `aliases` to pages for when you are changing urls but want to redirect
to the new one
- Name the homepage section `index` (previously empty string)
## 0.0.6 (2017-05-24)

View file

@ -499,10 +499,12 @@ impl Site {
/// Create a hashmap of paths to section
/// For example `content/posts/_index.md` key will be `posts`
/// The index section will always be called `index` so don't use a path such as
/// `content/index/_index.md` yourself
fn get_sections_map(&self) -> HashMap<String, Section> {
self.sections
.values()
.map(|s| (s.file.components.join("/"), s.clone()))
.map(|s| (if s.is_index() { "index".to_string() } else { s.file.components.join("/") }, s.clone()))
.collect()
}