Skip to content

Commit 47ac2b7

Browse files
committed
Allow overriding category display names
1 parent 4af36fc commit 47ac2b7

File tree

3 files changed

+46
-40
lines changed

3 files changed

+46
-40
lines changed

data/navigation.yml

Lines changed: 39 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,41 @@
11
# Shows the categories order for the navigation bar
22
tags:
3-
- featured
4-
- all
5-
- wiremock
6-
- analytics
7-
- backend
8-
- cloud
9-
- collaboration
10-
- customer_relation
11-
- developer_tools
12-
- ecommerce
13-
- education
14-
- email
15-
- enterprise
16-
- entertainment
17-
- financial
18-
- forms
19-
- hosting
20-
- iot
21-
- location
22-
- machine_learning
23-
- marketing
24-
- media
25-
- messaging
26-
- monitoring
27-
- open_data
28-
- payment
29-
- search
30-
- security
31-
- social
32-
- storage
33-
- support
34-
- telecom
35-
- text
36-
- tools
37-
- transport
3+
- id: featured
4+
- id: all
5+
- id: wiremock
6+
display: "WireMock"
7+
- id: analytics
8+
- id: backend
9+
- id: cloud
10+
- id: collaboration
11+
- id: customer_relation
12+
- id: developer_tools
13+
- id: ecommerce
14+
display: "E-Commerce"
15+
- id: education
16+
- id: email
17+
- id: enterprise
18+
- id: entertainment
19+
- id: financial
20+
- id: forms
21+
- id: hosting
22+
- id: iot
23+
display: "Internet of Things"
24+
- id: location
25+
- id: machine_learning
26+
- id: marketing
27+
- id: media
28+
- id: messaging
29+
- id: monitoring
30+
- id: open_data
31+
display: "Open Data"
32+
- id: payment
33+
- id: search
34+
- id: security
35+
- id: social
36+
- id: storage
37+
- id: support
38+
- id: telecom
39+
- id: text
40+
- id: tools
41+
- id: transport

i18n/en.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,3 @@ use_api:
1212
other: "Use this API in your project"
1313
how_use:
1414
other: "How to use ?"
15-
16-

layouts/partials/nav-tags.html

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,11 @@
3030
@click.outside="dropdown = false"
3131
class="absolute z-10 top-12 min-w-[16rem] bg-white rounded-md shadow-xl hidden py-2.5">
3232
{{ range $.Site.Data.navigation.tags }}
33-
{{ $tagId := . }}
33+
{{ $tagId := . }}
34+
{{ $tagDisplay := .display }}
3435
{{ range $taxonomyname, $taxonomy := $.Site.Taxonomies.tags }}
3536
{{ if eq $taxonomyname $tagId }}
37+
{{ $tagDisplay := default (strings.FirstUpper (replace .Page.Title "_" " ")) $tagDisplay }}
3638
<a class="{{ if eq .Page.Permalink $.Permalink }}text-sky-600{{ else }}text-slate-500{{ end }} hover:text-sky-600 block px-5 py-2" href="{{ .Page.Permalink }}">{{ strings.FirstUpper (replace .Page.Title "_" " ") }}</a>
3739
{{ end }}
3840
{{ end }}
@@ -42,10 +44,12 @@
4244
<div class="hidden lg:flex -mt-2">
4345
<div class="flex flex-col">
4446
{{ range $.Site.Data.navigation.tags }}
45-
{{ $tagId := . }}
47+
{{ $tagId := .id }}
48+
{{ $tagDisplay := .display }}
4649
{{ range $taxonomyname, $taxonomy := $.Site.Taxonomies.tags }}
4750
{{ if eq $taxonomyname $tagId }}
48-
<a class="{{ if eq .Page.Permalink $.Permalink }}text-sky-600 underline underline-offset-4 decoration-sky-600{{ else }}text-slate-500{{ end }} py-1.5 text-lg hover:text-sky-600 whitespace-nowrap" href="{{ .Page.Permalink }}">{{ strings.FirstUpper (replace .Page.Title "_" " ") }}</a>
51+
{{ $tagDisplay := default (strings.FirstUpper (replace .Page.Title "_" " ")) $tagDisplay }}
52+
<a class="{{ if eq .Page.Permalink $.Permalink }}text-sky-600 underline underline-offset-4 decoration-sky-600{{ else }}text-slate-500{{ end }} py-1.5 text-lg hover:text-sky-600 whitespace-nowrap" href="{{ .Page.Permalink }}">{{ $tagDisplay }}</a>
4953
{{ end }}
5054
{{ end }}
5155
{{ end }}

0 commit comments

Comments
 (0)