Link to dedicated page from site head (#158)

- dedicated pages can be linked from landing area
- briefer version of that page can be included on the singe-page content
This commit is contained in:
spi 2023-10-14 15:23:18 +02:00 committed by GitHub
parent 0f957c9bff
commit 5b4c79e689
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 1 deletions

View file

@ -0,0 +1,16 @@
---
title: "Brief Legal Information"
weight: 98
header_menu_title: "Legal"
navigation_menu_title: "Legal stuff"
header_menu: true
detailed_page_path: /legal/
detailed_page_homepage_content: true
---
The file **legal-brief.md** creates an internal link on the cover page without the leading icon.
If the parameter `detailed_page_homepage_content` is set to false neither this section nor the navigation menu entry will be shown (but the link on the cover page will be).
If `detailed_page_homepage_content` is set to true or is missing at all, the link, navigation menu and the content will be rendered. In that case this section might contain less or just summarized information compared to the single page referenced by the parameter `detailed_page_path`.
Want to see more about the details? See [dedicated page](legal) with more details or hit the button 'Legal' on the cover page.

View file

@ -0,0 +1,6 @@
---
title: "The single page referenced to by the Legal button on the cover page"
---
This file is a single page and is referenced by the button `Legal` on the cover start page.
It can contain more or additional information than the dedicated section on the homepage.

View file

@ -2,7 +2,7 @@
{{ $headless := .Site.GetPage "/homepage" }}
{{ $sections := $headless.Resources.ByType "page" }}
{{ $sections := cond .Site.BuildDrafts $sections (where $sections "Draft" "==" false) }}
{{ $content := where $sections "Params.external" "==" nil }}
{{ $content := where (where $sections "Params.external" "==" nil) "Params.detailed_page_homepage_content" "ne" false }}
<!-- Welcome screen that scrolls out of view -->
{{ if not .Params.header_use_video }}
@ -34,6 +34,8 @@
{{ if isset .Params "external" }}
<a class='btn site-menu' href='{{ .Params.external }}'>{{ $button_title }}&nbsp;<icon class="fa fa-external-link"></icon></a>
{{ else if isset .Params "detailed_page_path" }}
<a class='btn site-menu' href='{{ .Params.detailed_page_path }}'>{{ $button_title }}</a>
{{ else }}
{{ $fnav_title := .Title }}{{ with .Params.navigation_menu_title }}{{ $fnav_title = . }}{{ end }}
<a class='btn site-menu' data-title-anchor='{{ anchorize $fnav_title }}' href='#{{ anchorize $fnav_title }}'>{{ $button_title }}</a>