Skip to content

Commit ec23cb5

Browse files
authored
feat: add tags
1 parent 5750fb1 commit ec23cb5

File tree

14 files changed

+1507
-129
lines changed

14 files changed

+1507
-129
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ exampleSite/content/de
2121
/resources/
2222
/exampleSite/resources/
2323
/exampleSite/data/sprites/
24+
/public/
2425
VERSION
2526

2627
# hugo

i18n/de.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,36 @@ pagination_page_state: "{{ .PageNumber }}/{{ .TotalPages }}"
5454

5555
custom_product_of_cybertec: Ein Produkt von CYBERTEC
5656
custom_support_button: Support
57+
58+
# Taxonomy Terms
59+
taxonomy_terms_count:
60+
one: "{{ . }} Begriff"
61+
other: "{{ . }} Begriffe"
62+
taxonomy_terms_view_all_pages: "Alle Seiten für {{ . }} anzeigen"
63+
taxonomy_terms_no_description: Keine Beschreibung verfügbar
64+
taxonomy_terms_page_count:
65+
one: "{{ . }} Seite"
66+
other: "{{ . }} Seiten"
67+
taxonomy_terms_latest_prefix: 'Neueste:'
68+
taxonomy_terms_empty_title: Keine Begriffe gefunden
69+
taxonomy_terms_empty_description: "Derzeit sind keine {{ . }} verfügbar."
70+
71+
# Taxonomy Links
72+
taxonomy_links_browse_by_topic: "Dokumentation nach Thema durchsuchen:"
73+
taxonomy_links_all_tags: Alle Tags
74+
taxonomy_links_all_categories: Alle Kategorien
75+
taxonomy_links_all_features: Alle Features
76+
77+
# Taxonomy Meta
78+
taxonomy_meta_tags: Tags
79+
taxonomy_meta_categories: Kategorien
80+
taxonomy_meta_features: Features
81+
taxonomy_meta_view_tagged: "Alle Seiten mit Tag '{{ . }}' anzeigen"
82+
taxonomy_meta_view_category: "Alle Seiten in Kategorie '{{ . }}' anzeigen"
83+
taxonomy_meta_view_feature: "Alle Seiten für Feature '{{ . }}' anzeigen"
84+
85+
# Accessibility & UI
86+
skip_to_main_content: Zum Hauptinhalt springen
87+
88+
# Shortcodes
89+
shortcode_expand_default: Erweitern

i18n/en.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,36 @@ pagination_page_state: "{{ .PageNumber }}/{{ .TotalPages }}"
5454

5555
custom_product_of_cybertec: A product of CYBERTEC
5656
custom_support_button: Support
57+
58+
# Taxonomy Terms
59+
taxonomy_terms_count:
60+
one: "{{ . }} term"
61+
other: "{{ . }} terms"
62+
taxonomy_terms_view_all_pages: "View all pages for {{ . }}"
63+
taxonomy_terms_no_description: No description available
64+
taxonomy_terms_page_count:
65+
one: "{{ . }} page"
66+
other: "{{ . }} pages"
67+
taxonomy_terms_latest_prefix: 'Latest:'
68+
taxonomy_terms_empty_title: No terms found
69+
taxonomy_terms_empty_description: "There are currently no {{ . }} available."
70+
71+
# Taxonomy Links
72+
taxonomy_links_browse_by_topic: "Browse Documentation by Topic:"
73+
taxonomy_links_all_tags: All Tags
74+
taxonomy_links_all_categories: All Categories
75+
taxonomy_links_all_features: All Features
76+
77+
# Taxonomy Meta
78+
taxonomy_meta_tags: Tags
79+
taxonomy_meta_categories: Categories
80+
taxonomy_meta_features: Features
81+
taxonomy_meta_view_tagged: "View all pages tagged with {{ . }}"
82+
taxonomy_meta_view_category: "View all pages in category {{ . }}"
83+
taxonomy_meta_view_feature: "View all pages for feature {{ . }}"
84+
85+
# Accessibility & UI
86+
skip_to_main_content: Skip to main content
87+
88+
# Shortcodes
89+
shortcode_expand_default: Expand

layouts/_default/baseof.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
<body itemscope itemtype="https://schema.org/WebPage">
2525
<div class="w-full flex justify-center">
26-
<a href="#main-content" id="gdoc-to-main" class="gdoc-markdown__link">Skip to main content</a>
26+
<a href="#main-content" id="gdoc-to-main" class="gdoc-markdown__link">{{ i18n "skip_to_main_content" }}</a>
2727
</div>
2828

2929
{{ partial "svg-icon-symbols" . }}

layouts/_default/list.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ <h1>{{ partial "utils/title" . }}</h1>
99
class="gdoc-markdown gdoc-markdown__align--{{ default "left" (.Page.Params.geekdocAlign | lower) }}"
1010
id="main-content" tabindex="-1"
1111
>
12+
{{ partial "page-metadata" . }}
13+
14+
{{- partial "taxonomy-meta" . -}}
15+
1216
{{ partial "utils/content" . }}
17+
18+
{{- partial "taxonomy-links" . -}}
1319
</article>
1420
{{ end }}

layouts/_default/taxonomy.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@ <h1 class="gdoc-post__title">
1515
<div class="gdoc-post__readmore">
1616
{{ if .Truncated }}
1717
<a
18-
class="flex-inline align-center fake-link"
18+
class="taxonomy-link taxonomy-link-readmore flex-inline align-center"
1919
title="{{ i18n "posts_read_more" }}"
2020
href="{{ .RelPermalink }}"
2121
>
2222
{{ i18n "posts_read_more" }}
23-
<i class="gdoc-icon">gdoc_arrow_right_alt</i>
23+
<svg class="gdoc-icon" aria-hidden="true">
24+
<use xlink:href="#gdoc_arrow_right_alt"></use>
25+
</svg>
2426
</a>
2527
{{ end }}
2628
</div>

layouts/_default/terms.html

Lines changed: 98 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,103 @@
11
{{ define "main" }}
2-
<div id="main-content" tabindex="-1">
3-
{{ range .Paginator.Pages.ByTitle }}
4-
<article class="gdoc-post">
5-
<header class="gdoc-post__header">
6-
<h1 class="gdoc-post__title">
7-
<a href="{{ .RelPermalink }}">{{ partial "utils/title" . }}</a>
8-
</h1>
9-
</header>
2+
<div id="main-content" tabindex="-1" class="taxonomy-terms-page">
3+
{{- /* Page Header Section */ -}}
4+
<header class="taxonomy-terms-header">
5+
<h1 class="taxonomy-terms-title">{{ partial "utils/title" . }}</h1>
6+
{{- if .Description -}}
7+
<p class="taxonomy-terms-description">{{ .Description }}</p>
8+
{{- end -}}
9+
{{- if gt (len .Pages) 0 -}}
10+
<p class="taxonomy-terms-count" aria-live="polite">
11+
{{- $total := len .Pages -}}
12+
{{- i18n "taxonomy_terms_count" $total -}}
13+
</p>
14+
{{- end -}}
15+
</header>
1016

11-
<footer class="gdoc-post__meta flex align-center">
12-
<span class="flex align-center no-wrap">
13-
{{ $pageCount := len .Pages }}
14-
<svg class="gdoc-icon gdoc_tag"><use xlink:href="#gdoc_tag"></use></svg>
15-
<span class="gdoc-post__tag">
16-
{{ i18n "posts_count" $pageCount }}
17-
</span>
18-
</span>
17+
{{- /* Main Content Grid */ -}}
18+
{{- if gt (len .Paginator.Pages) 0 -}}
19+
<div class="taxonomy-terms-grid" role="list">
20+
{{- range .Paginator.Pages.ByTitle -}}
21+
{{- $pageCount := len .Pages -}}
22+
{{- $latest := index (.Pages.ByDate.Reverse) 0 -}}
23+
<article
24+
class="taxonomy-term-card"
25+
role="listitem"
26+
aria-labelledby="term-{{ .Slug }}"
27+
>
28+
{{- /* Clickable Card Link - Entire card is clickable */ -}}
29+
<a
30+
href="{{ .RelPermalink }}"
31+
class="taxonomy-term-card__link"
32+
aria-label="{{ i18n "taxonomy_terms_view_all_pages" (partial "utils/title" .) }}"
33+
>
34+
<header class="taxonomy-term-card__header">
35+
<h2 class="taxonomy-term-card__title" id="term-{{ .Slug }}">
36+
{{- partial "utils/title" . -}}
37+
</h2>
38+
</header>
1939

20-
<span class="flex align-center no-wrap">
21-
<svg class="gdoc-icon gdoc_star"><use xlink:href="#gdoc_star"></use></svg>
22-
<span>
23-
{{ $latest := index .Pages.ByDate 0 }}
24-
{{ with $latest }}
25-
<a href="{{ .RelPermalink }}">{{ partial "utils/title" . }}</a>
26-
{{ end }}
27-
</span>
28-
</span>
29-
</footer>
30-
</article>
31-
{{ end }}
40+
<div class="taxonomy-term-card__body">
41+
{{- if .Description -}}
42+
<p class="taxonomy-term-card__description">{{ .Description | truncate 120 }}</p>
43+
{{- else if $latest -}}
44+
<p class="taxonomy-term-card__description">{{ $latest.Summary | plainify | truncate 120 }}</p>
45+
{{- else -}}
46+
<p class="taxonomy-term-card__description taxonomy-term-card__description--empty">
47+
{{ i18n "taxonomy_terms_no_description" }}
48+
</p>
49+
{{- end -}}
50+
</div>
51+
52+
<footer class="taxonomy-term-card__footer">
53+
<div class="taxonomy-term-card__meta">
54+
<span
55+
class="taxonomy-term-card__count"
56+
aria-label="{{ i18n "taxonomy_terms_page_count" $pageCount }}"
57+
>
58+
<svg class="gdoc-icon gdoc_tag" aria-hidden="true">
59+
<use xlink:href="#gdoc_tag"></use>
60+
</svg>
61+
<span class="taxonomy-term-card__count-text">
62+
{{- i18n "taxonomy_terms_page_count" $pageCount -}}
63+
</span>
64+
</span>
65+
66+
{{- if $latest -}}
67+
<span class="taxonomy-term-card__latest">
68+
<svg class="gdoc-icon gdoc_star" aria-hidden="true">
69+
<use xlink:href="#gdoc_star"></use>
70+
</svg>
71+
<span class="taxonomy-term-card__latest-text">
72+
{{ i18n "taxonomy_terms_latest_prefix" }}
73+
<span class="taxonomy-term-card__latest-title">
74+
{{- partial "utils/title" $latest | truncate 40 -}}
75+
</span>
76+
</span>
77+
</span>
78+
{{- end -}}
79+
</div>
80+
</footer>
81+
</a>
82+
</article>
83+
{{- end -}}
84+
</div>
85+
86+
{{- /* Pagination */ -}}
87+
{{- if gt .Paginator.TotalPages 1 -}}
88+
{{- partial "pagination.html" . -}}
89+
{{- end -}}
90+
{{- else -}}
91+
{{- /* Empty State */ -}}
92+
<div class="taxonomy-terms-empty" role="status" aria-live="polite">
93+
<svg class="taxonomy-terms-empty__icon" aria-hidden="true">
94+
<use xlink:href="#gdoc_tag"></use>
95+
</svg>
96+
<h2 class="taxonomy-terms-empty__title">{{ i18n "taxonomy_terms_empty_title" }}</h2>
97+
<p class="taxonomy-terms-empty__description">
98+
{{ i18n "taxonomy_terms_empty_description" .Data.Plural }}
99+
</p>
100+
</div>
101+
{{- end -}}
32102
</div>
33-
{{ partial "pagination.html" . }}
34103
{{ end }}
Lines changed: 68 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,81 @@
1-
<span class="flex align-center no-wrap">
2-
<svg class="gdoc-icon gdoc_date"><use xlink:href="#gdoc_date"></use></svg>
1+
{{- /* Date Display - Use Lastmod if available, fallback to Date */ -}}
2+
{{- $displayDate := .Lastmod -}}
3+
{{- if $displayDate.IsZero -}}
4+
{{- $displayDate = .Date -}}
5+
{{- end -}}
6+
7+
{{- /* Check if page was updated after original publish date */ -}}
8+
{{- $isUpdated := false -}}
9+
{{- if and (not .Date.IsZero) (not .Lastmod.IsZero) -}}
10+
{{- $isUpdated = .Lastmod.After (.Date.AddDate 0 0 1) -}}
11+
{{- end -}}
12+
13+
{{- /* Format datetime attribute - RFC3339/ISO8601 format for proper parsing */ -}}
14+
{{- $datetimeISO := $displayDate.Format "RFC3339" -}}
15+
16+
{{- /* Format human-readable date - use localized format if available */ -}}
17+
{{- $dateFormat := "Jan 2, 2006" -}}
18+
{{- $dateDisplay := $displayDate.Format $dateFormat -}}
19+
20+
{{- if not $displayDate.IsZero -}}
21+
<span class="flex align-center no-wrap" aria-label="{{ if $isUpdated }}{{ i18n "posts_update_prefix" }} {{ end }}{{ $dateDisplay }}">
22+
<svg class="gdoc-icon gdoc_date" aria-hidden="true">
23+
<use xlink:href="#gdoc_date"></use>
24+
</svg>
325
<span class="gdoc-post__tag">
4-
<time datetime="{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" | safeHTML }}">
5-
{{ if .Lastmod.After (.Date.AddDate 0 0 1) }}
6-
{{ i18n "posts_update_prefix" }}
7-
{{ end }}
8-
{{ .Lastmod.Format "Jan 2, 2006" }}
26+
<time datetime="{{ $datetimeISO }}" title="{{ $dateDisplay }}">
27+
{{- if $isUpdated -}}
28+
<span class="gdoc-post__date-prefix">{{ i18n "posts_update_prefix" }} </span>
29+
{{- end -}}
30+
<span class="gdoc-post__date-value">{{ $dateDisplay }}</span>
931
</time>
1032
</span>
1133
</span>
34+
{{- end -}}
1235

13-
<span class="flex align-center no-wrap">
14-
<svg class="gdoc-icon gdoc_timer"><use xlink:href="#gdoc_timer"></use></svg>
36+
{{- /* Reading Time */ -}}
37+
{{- if gt .ReadingTime 0 -}}
38+
<span class="flex align-center no-wrap" aria-label="{{ i18n "posts_read_time" .ReadingTime }}">
39+
<svg class="gdoc-icon gdoc_timer" aria-hidden="true">
40+
<use xlink:href="#gdoc_timer"></use>
41+
</svg>
1542
<span class="gdoc-post__tag">{{ i18n "posts_read_time" .ReadingTime }}</span>
1643
</span>
44+
{{- end -}}
1745

18-
{{ $tc := 0 }}
19-
{{ with .Params.tags }}
20-
{{ range sort . }}
21-
{{ $name := . }}
22-
{{ with $.Site.GetPage (printf "/tags/%s" $name | urlize) }}
23-
{{ if eq $tc 0 }}
46+
{{- /* Tags Display */ -}}
47+
{{- $tagCount := 0 -}}
48+
{{- with .Params.tags -}}
49+
{{- range sort . -}}
50+
{{- $tagName := . -}}
51+
{{- with $.Site.GetPage (printf "/tags/%s" ($tagName | urlize)) -}}
52+
{{- if eq $tagCount 0 -}}
2453
<span class="flex align-center no-wrap">
25-
<svg class="gdoc-icon gdoc_bookmark"><use xlink:href="#gdoc_bookmark"></use></svg>
26-
{{ template "post-tag" dict "name" $name "page" . }}
54+
<svg class="gdoc-icon gdoc_bookmark" aria-hidden="true">
55+
<use xlink:href="#gdoc_bookmark"></use>
56+
</svg>
57+
{{- template "post-tag" dict "name" $tagName "page" . -}}
2758
</span>
28-
{{ else }}
59+
{{- else -}}
2960
<span class="flex align-center">
30-
{{ template "post-tag" dict "name" $name "page" . }}
61+
{{- template "post-tag" dict "name" $tagName "page" . -}}
3162
</span>
32-
{{ end }}
33-
{{ end }}
34-
{{ $tc = (add $tc 1) }}
35-
{{ end }}
36-
{{ end }}
63+
{{- end -}}
64+
{{- end -}}
65+
{{- $tagCount = (add $tagCount 1) -}}
66+
{{- end -}}
67+
{{- end -}}
3768

38-
{{ define "post-tag" }}
39-
<span class="gdoc-post__tag gdoc-button gdoc-button--regular">
40-
<a
41-
class="gdoc-button__link"
42-
href="{{ .page.RelPermalink }}"
43-
title="{{ i18n "posts_tagged_with" .name }}"
44-
>
45-
{{ .name }}
46-
</a>
47-
</span>
48-
{{ end }}
69+
{{- /* Post Tag Template */ -}}
70+
{{- define "post-tag" -}}
71+
<span class="gdoc-post__tag gdoc-button gdoc-button--regular">
72+
<a
73+
class="gdoc-button__link"
74+
href="{{ .page.RelPermalink }}"
75+
title="{{ i18n "posts_tagged_with" .name }}"
76+
aria-label="{{ i18n "posts_tagged_with" .name }}"
77+
>
78+
{{ .name }}
79+
</a>
80+
</span>
81+
{{- end -}}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{{- /*
2+
Partial: taxonomy-links
3+
Displays navigation links to taxonomy index pages
4+
Usage: {{ partial "taxonomy-links.html" . }}
5+
*/ -}}
6+
{{- if or .Site.Taxonomies.tags .Site.Taxonomies.categories .Site.Taxonomies.features -}}
7+
<div class="taxonomy-links-container">
8+
<p>{{ i18n "taxonomy_links_browse_by_topic" }}</p>
9+
<div class="taxonomy-links">
10+
{{- if .Site.Taxonomies.tags -}}
11+
<a href="{{ "tags/" | relLangURL }}" class="taxonomy-link taxonomy-link-tags">
12+
{{ i18n "taxonomy_links_all_tags" }}
13+
</a>
14+
{{- end -}}
15+
{{- if .Site.Taxonomies.categories -}}
16+
<a href="{{ "categories/" | relLangURL }}" class="taxonomy-link taxonomy-link-categories">
17+
{{ i18n "taxonomy_links_all_categories" }}
18+
</a>
19+
{{- end -}}
20+
{{- if .Site.Taxonomies.features -}}
21+
<a href="{{ "features/" | relLangURL }}" class="taxonomy-link taxonomy-link-features">
22+
{{ i18n "taxonomy_links_all_features" }}
23+
</a>
24+
{{- end -}}
25+
</div>
26+
</div>
27+
{{- end -}}
28+

0 commit comments

Comments
 (0)