Add in-section Next/Prev content pointers

Conflicts:
	docs/content/meta/release-notes.md
	docs/content/templates/variables.md
This commit is contained in:
Dave Johnston 2014-04-18 07:23:13 +00:00 committed by bep
parent 837922d32b
commit a5f5106154
4 changed files with 17 additions and 0 deletions

View file

@ -10,6 +10,7 @@ title: Release Notes
weight: 10
---
## **0.12.0** Sept 1, 2014
A lot has happened since Hugo v0.11.0 was released. Most of the work has been
@ -56,6 +57,9 @@ This release represents over 110 code commits from 29 different contributors.
* Renamed Indexes > [Taxonomies](/taxonomies/overview)
* Renamed Chrome > [Partials](/templates/partials)
## Next release
* Added section Prev/Next pointers.
## **0.10.0** March 1, 2014
This release represents over 110 code commits from 29 different contributors.

View file

@ -39,6 +39,8 @@ matter, content or derived from file location.
**.TableOfContents** The rendered table of contents for this content.<br>
**.Prev** Pointer to the previous content (based on pub date).<br>
**.Next** Pointer to the following content (based on pub date).<br>
**.PrevInSection** Pointer to the previous content within the same section (based on pub date)<br>
**.NextInSection** Pointer to the following content within the same section (based on pub date)<br>
**.FuzzyWordCount** The approximate number of words in the content.<br>
**.WordCount** The number of words in the content.<br>
**.ReadingTime** The estimated time it takes to read the content in minutes.<br>

View file

@ -80,6 +80,8 @@ type PageMeta struct {
type Position struct {
Prev *Page
Next *Page
PrevInSection *Page
NextInSection *Page
}
type Pages []*Page

View file

@ -724,6 +724,15 @@ func (s *Site) assembleSections() {
for k := range s.Sections {
s.Sections[k].Sort()
for i, wp := range s.Sections[k] {
if i > 0 {
wp.Page.NextInSection = s.Sections[k][i - 1].Page;
}
if i < len(s.Sections[k]) - 1 {
wp.Page.PrevInSection = s.Sections[k][i + 1].Page;
}
}
}
}