mirror of
https://github.com/imfing/hextra.git
synced 2025-07-01 17:27:39 -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.
|
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"}
|
```yaml {filename="hugo.yaml"}
|
||||||
params:
|
params:
|
||||||
tabs:
|
page:
|
||||||
sync: true
|
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
|
|
||||||
---
|
|
||||||
```
|
```
|
||||||
|
|
||||||
With this enabled the following two tab blocks will always display the same selected item:
|
With this enabled the following two tab blocks will always display the same selected item:
|
||||||
|
@ -132,10 +132,6 @@ params:
|
|||||||
# link: /
|
# link: /
|
||||||
width: wide
|
width: wide
|
||||||
|
|
||||||
page:
|
|
||||||
# full (100%), wide (90rem), normal (80rem)
|
|
||||||
width: normal
|
|
||||||
|
|
||||||
theme:
|
theme:
|
||||||
# light | dark | system
|
# light | dark | system
|
||||||
default: system
|
default: system
|
||||||
@ -184,8 +180,11 @@ params:
|
|||||||
# hover | always
|
# hover | always
|
||||||
display: hover
|
display: hover
|
||||||
|
|
||||||
tabs:
|
page:
|
||||||
sync: true
|
# full (100%), wide (90rem), normal (80rem)
|
||||||
|
width: normal
|
||||||
|
tabs:
|
||||||
|
sync: true
|
||||||
|
|
||||||
comments:
|
comments:
|
||||||
enable: false
|
enable: false
|
||||||
|
@ -1,10 +1,7 @@
|
|||||||
{{- $items := split (.Get "items") "," -}}
|
{{- $items := split (.Get "items") "," -}}
|
||||||
{{- $defaultIndex := int ((.Get "defaultIndex") | default "0") -}}
|
{{- $defaultIndex := int ((.Get "defaultIndex") | default "0") -}}
|
||||||
|
|
||||||
{{- $enableSync := site.Params.tabs.sync | default false -}}
|
{{- $enableSync := site.Params.page.tabs.sync | default false -}}
|
||||||
{{- with .Page.Params.tabsSync }}
|
|
||||||
{{- $enableSync = . -}}
|
|
||||||
{{- end -}}
|
|
||||||
|
|
||||||
{{- if not $items -}}
|
{{- if not $items -}}
|
||||||
{{ errorf "no items provided" }}
|
{{ errorf "no items provided" }}
|
||||||
|
Reference in New Issue
Block a user