Navigation
Displays previous and next article navigation links.
Location : layouts/_partials/widgets/navigation.html
Parameters :
| Parameter | Type | Description | Default |
|---|---|---|---|
page | Page | Page context | required |
site | Site | Site context | required |
navigationBySection | boolean | Navigate within section only | true |
showIcon | boolean | Show < and > icons | true |
prevText | string | Text for previous link | "Previous" |
nextText | string | Text for next link | "Next" |
class | string | Additional CSS classes | - |
key | string | Config key for visibility | "Navigation" |
Navigation Scope :
- Section-scoped (
navigationBySection: true, default): Uses.PrevInSection/.NextInSection - Global (
navigationBySection: false): Uses.Prev/.Next
Configuration :
yaml
params:
showNavigation: true
showNavigationIcon: true
navigationBySection: true # true = section-scoped, false = global
navigationPrevText: "Previous"
navigationNextText: "Next"Custom Navigation Links :
Override automatic navigation in front matter:
yaml
# String format (page path)
navigationPrev: "/blog/my-previous-post"
navigationNext: "/blog/my-next-post"
# Map format (custom URL and title)
navigationPrev:
url: "/custom/path"
title: "Custom Title"
navigationNext:
url: "/another/path"
title: "Another Title"
# Change scope for this page
navigationBySection: falseExamples :
go
// Basic usage (section-scoped)
{{ partial "widgets/navigation.html" (dict "page" . "site" .Site) }}
// Global navigation (weight-aware)
{{ partial "widgets/navigation.html" (dict
"page" .
"site" .Site
"navigationBySection" false
) }}
// Custom labels
{{ partial "widgets/navigation.html" (dict
"page" .
"site" .Site
"prevText" "← Older"
"nextText" "Newer →"
) }}
// Without icons
{{ partial "widgets/navigation.html" (dict
"page" .
"site" .Site
"showIcon" false
) }}