The announcement bar module makes important thing stand out, such as news and project’s releases.
Module | github.com/hbstack/announcement-bar |
---|---|
Repository | ⭐ Please consider giving a star if your like it. |
Stars | |
Version | |
Used by | |
Requirements | |
License | |
Usage | See how to use modules. |
Parameter | Type | Default | Description |
---|---|---|---|
bg | string | primary | The background color. |
color | string | #fff | The text color. |
interval | number | 5000 | The interval (in millisecond) between of announcements. |
expand_stall_threshold | number | 1000 | How many milliseconds must elapse before considering the expansion (show all announcements) experience stalled. |
hugo.toml
1[params]
2 [params.hb]
3 [params.hb.announcement_bar]
4 expand_stall_threshold = 1000
5 interval = 5000
hugo.yaml
1params:
2 hb:
3 announcement_bar:
4 expand_stall_threshold: 1000
5 interval: 5000
hugo.json
1{
2 "params": {
3 "hb": {
4 "announcement_bar": {
5 "expand_stall_threshold": 1000,
6 "interval": 5000
7 }
8 }
9 }
10}
This module is designed to work on both of monolingual and multilingual sites, you’ll need to create announcements data file per language under the data/announcements
folder.
1$ tree data/announcements
2├── en.toml
3├── zh-hans.toml
4└── zh-hant.toml
As the output of tree
shown, we defined announcements for en
, zh-hans
and zh-hant
sites.
Property | Type | Default | Required | Description |
---|---|---|---|---|
title | string | - | Y | The title of announcement, support Markdown syntax. |
url | string | - | N | The url of the announcement. |
weight | number | - | N | Lower get higher priority. |
url
is set, please make sure there isn’t invalid content inside the title
, such as link.data/announcements/en.toml
1[external]
2 title = 'The announcement linked to external site.'
3 url = 'https://hugomods.com/'
4 weight = 3
5[internal]
6 title = 'Internal announcement.'
7 url = 'modules/enhancement/announcement-bar'
8 weight = 2
9[plain]
10 title = 'A **plain** text announcement.'
11 weight = 1
data/announcements/en.yaml
1external:
2 title: The announcement linked to external site.
3 url: https://hugomods.com/
4 weight: 3
5internal:
6 title: Internal announcement.
7 url: modules/enhancement/announcement-bar
8 weight: 2
9plain:
10 title: A **plain** text announcement.
11 weight: 1
data/announcements/en.json
1{
2 "external": {
3 "title": "The announcement linked to external site.",
4 "url": "https://hugomods.com/",
5 "weight": 3
6 },
7 "internal": {
8 "title": "Internal announcement.",
9 "url": "modules/enhancement/announcement-bar",
10 "weight": 2
11 },
12 "plain": {
13 "title": "A **plain** text announcement.",
14 "weight": 1
15 }
16}