Browse Source

Name the index section

index-subcmd
Vincent Prouillet 7 years ago
parent
commit
6508b7e4d3
2 changed files with 4 additions and 1 deletions
  1. +1
    -0
      CHANGELOG.md
  2. +3
    -1
      src/site.rs

+ 1
- 0
CHANGELOG.md View File

@@ -9,6 +9,7 @@
- Add `section` to a page Tera context if there is one - 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 - Add `aliases` to pages for when you are changing urls but want to redirect
to the new one to the new one
- Name the homepage section `index` (previously empty string)


## 0.0.6 (2017-05-24) ## 0.0.6 (2017-05-24)




+ 3
- 1
src/site.rs View File

@@ -499,10 +499,12 @@ impl Site {


/// Create a hashmap of paths to section /// Create a hashmap of paths to section
/// For example `content/posts/_index.md` key will be `posts` /// 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> { fn get_sections_map(&self) -> HashMap<String, Section> {
self.sections self.sections
.values() .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() .collect()
} }




Loading…
Cancel
Save