Website: allow separate page title for TOC

You can now set a page title and a separate title for the table of
contents with:

```
---
title: "Manager Configuration: MQTT"
titleTOC: MQTT
---
```
This commit is contained in:
Sybren A. Stüvel 2024-03-13 18:42:52 +01:00
parent a23c95a738
commit 5c60561ddb
2 changed files with 15 additions and 2 deletions

@ -71,11 +71,11 @@
{{- printf " is-active" }}
{{- end }}"
>
{{ partial "utils/title" . }}
{{ partial "utils/title-toc" . }}
</a>
</span>
{{ else }}
<span class="flex">{{ partial "utils/title" . }}</span>
<span class="flex">{{ partial "utils/title-toc" . }}</span>
{{ end }}
{{ if $doCollapse }}
<svg class="gdoc-icon toggle gdoc_keyboard_arrow_left">

@ -0,0 +1,13 @@
{{ $title := "" }}
{{ if .Page.Params.TitleTOC }}
{{ $title = .Page.Params.TitleTOC }}
{{ else if .Title }}
{{ $title = .Title }}
{{ else if and .IsSection .File }}
{{ $title = path.Base .File.Dir | humanize | title }}
{{ else if and .IsPage .File }}
{{ $title = .File.BaseFileName | humanize | title }}
{{ end }}
{{ return $title }}