mirror of
https://github.com/imfing/hextra.git
synced 2025-07-01 05:47:18 -04:00
Move tabs sync setting under page params
This commit is contained in:
@ -17,21 +17,13 @@ next: /docs/guide/deploy-site
|
||||
|
||||
Tabs with the same list of `items` can be synchronized. When enabled, selecting a tab updates all other tabs with the same `items` and remembers the selection across pages.
|
||||
|
||||
Enable globally in your `hugo.yaml`:
|
||||
Enable globally in your `hugo.yaml` under the `page` section:
|
||||
|
||||
```yaml {filename="hugo.yaml"}
|
||||
params:
|
||||
tabs:
|
||||
sync: true
|
||||
```
|
||||
|
||||
Or enable it for a single page in the front matter:
|
||||
|
||||
```yaml {filename="content/docs/my-page.md"}
|
||||
---
|
||||
title: My Page
|
||||
tabsSync: true
|
||||
---
|
||||
page:
|
||||
tabs:
|
||||
sync: true
|
||||
```
|
||||
|
||||
With this enabled the following two tab blocks will always display the same selected item:
|
||||
|
@ -132,10 +132,6 @@ params:
|
||||
# link: /
|
||||
width: wide
|
||||
|
||||
page:
|
||||
# full (100%), wide (90rem), normal (80rem)
|
||||
width: normal
|
||||
|
||||
theme:
|
||||
# light | dark | system
|
||||
default: system
|
||||
@ -184,8 +180,11 @@ params:
|
||||
# hover | always
|
||||
display: hover
|
||||
|
||||
tabs:
|
||||
sync: true
|
||||
page:
|
||||
# full (100%), wide (90rem), normal (80rem)
|
||||
width: normal
|
||||
tabs:
|
||||
sync: true
|
||||
|
||||
comments:
|
||||
enable: false
|
||||
|
@ -1,10 +1,7 @@
|
||||
{{- $items := split (.Get "items") "," -}}
|
||||
{{- $defaultIndex := int ((.Get "defaultIndex") | default "0") -}}
|
||||
|
||||
{{- $enableSync := site.Params.tabs.sync | default false -}}
|
||||
{{- with .Page.Params.tabsSync }}
|
||||
{{- $enableSync = . -}}
|
||||
{{- end -}}
|
||||
{{- $enableSync := site.Params.page.tabs.sync | default false -}}
|
||||
|
||||
{{- if not $items -}}
|
||||
{{ errorf "no items provided" }}
|
||||
|
Reference in New Issue
Block a user