Skip to content

Commit

Permalink
Add option to sub navigation layout to choose from which page to show…
Browse files Browse the repository at this point in the history
… navigation items below
  • Loading branch information
paulrobertlloyd committed Dec 23, 2023
1 parent aa6a82e commit 5e59fa7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion docs/layouts/sub-navigation.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,8 @@ title: Page title
Page content
```

Use [common front matter options](/layouts#common-front-matter-options) to customise which items and content appear within a page.
In addition to [common front matter options](/layouts#common-front-matter-options), this layout also accepts the following options:

| Name | Type | Description |
| :------------- | :----- | :--------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **sectionKey** | string | Parent navigation key (usually a page title) to show items below in the sub navigation. Default is `homeKey` value provided in [plugin options](/options). |
2 changes: 1 addition & 1 deletion layouts/sub-navigation.njk
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<div class="govuk-grid-row">
<div class="govuk-grid-column-one-quarter-from-desktop">
{{ xGovukSubNavigation({
items: collections.ordered | eleventyNavigation(options.homeKey) | itemsFromNavigation(page.url, { pathPrefix: options.pathPrefix })
items: collections.ordered | eleventyNavigation(sectionKey or options.homeKey) | itemsFromNavigation(page.url, { pathPrefix: options.pathPrefix })
}) }}
</div>
<div class="govuk-grid-column-three-quarters-from-desktop">
Expand Down

0 comments on commit 5e59fa7

Please sign in to comment.