Skip to content

Commit

Permalink
Name the index section
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincent Prouillet committed Jun 19, 2017
1 parent 77ad654 commit 6508b7e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 3 additions & 1 deletion src/site.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand Down

0 comments on commit 6508b7e

Please sign in to comment.