ref: a5f5106154ac1f5cd0d84a5a2212b0ec500edc21
parent: 837922d32bc1d0d2fbc50af07947e6b858df1550
author: Dave Johnston <[email protected]>
date: Fri Apr 18 03:23:13 EDT 2014
Add in-section Next/Prev content pointers Conflicts: docs/content/meta/release-notes.md docs/content/templates/variables.md
--- a/docs/content/meta/release-notes.md
+++ b/docs/content/meta/release-notes.md
@@ -10,6 +10,7 @@
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
@@ -55,6 +56,9 @@
* More informative verbose output
* Renamed Indexes > [Taxonomies](/taxonomies/overview)
* Renamed Chrome > [Partials](/templates/partials)
+
+## Next release
+ * Added section Prev/Next pointers.
## **0.10.0** March 1, 2014
--- a/docs/content/templates/variables.md
+++ b/docs/content/templates/variables.md
@@ -39,6 +39,8 @@
**.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>
--- a/hugolib/page.go
+++ b/hugolib/page.go
@@ -80,6 +80,8 @@
type Position struct {
Prev *Page
Next *Page
+ PrevInSection *Page
+ NextInSection *Page
}
type Pages []*Page
--- a/hugolib/site.go
+++ b/hugolib/site.go
@@ -724,6 +724,15 @@
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;
+ }
+ }
}
}