commit a5f5106154ac1f5cd0d84a5a2212b0ec500edc21
parent 837922d32bc1d0d2fbc50af07947e6b858df1550
Author: Dave Johnston <johnsto@gmail.com>
Date: Fri, 18 Apr 2014 07:23:13 +0000
Add in-section Next/Prev content pointers
Conflicts:
docs/content/meta/release-notes.md
docs/content/templates/variables.md
Diffstat:
4 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/docs/content/meta/release-notes.md b/docs/content/meta/release-notes.md
@@ -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.
diff --git a/docs/content/templates/variables.md b/docs/content/templates/variables.md
@@ -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>
diff --git a/hugolib/page.go b/hugolib/page.go
@@ -80,6 +80,8 @@ type PageMeta struct {
type Position struct {
Prev *Page
Next *Page
+ PrevInSection *Page
+ NextInSection *Page
}
type Pages []*Page
diff --git a/hugolib/site.go b/hugolib/site.go
@@ -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;
+ }
+ }
}
}