diff --git a/docs/layouts/sub-navigation.md b/docs/layouts/sub-navigation.md index 4b6a930a..3a52533b 100644 --- a/docs/layouts/sub-navigation.md +++ b/docs/layouts/sub-navigation.md @@ -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). | diff --git a/layouts/sub-navigation.njk b/layouts/sub-navigation.njk index 39f8962d..5fd2567b 100644 --- a/layouts/sub-navigation.njk +++ b/layouts/sub-navigation.njk @@ -11,7 +11,7 @@
{{ 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 }) }) }}