Skip to content

Commit 2c2e662

Browse files
committed
dev: better website footer
1 parent de3b816 commit 2c2e662

File tree

2 files changed

+84
-1
lines changed

2 files changed

+84
-1
lines changed

docs/hugo.yaml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,25 @@ params:
9898

9999
footer:
100100
enable: true
101-
displayCopyright: true
101+
displayCopyright: false
102102
displayPoweredBy: true
103103
width: normal
104+
links:
105+
- title: Bluesky
106+
url: "https://bsky.app/profile/golangci-lint.run"
107+
icon: bluesky
108+
- title: Mastodon
109+
url: "https://fosstodon.org/@golangcilint"
110+
icon: mastodon
111+
- title: Twitter
112+
url: "https://twitter.com/golangci"
113+
icon: twitter
114+
- title: Slack
115+
url: "https://gophers.slack.com/archives/CS0TBRKPC"
116+
icon: slack
117+
- title: GitHub
118+
url: "https://github.com/golangci/golangci-lint"
119+
icon: github
104120

105121
# Display the last modification date
106122
displayUpdatedDate: true

docs/layouts/_partials/footer.html

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{{- /* Modified version of https://github.com/imfing/hextra/blob/v0.9.7/layouts/partials/footer.html */ -}}
2+
{{- $enableFooterSwitches := .Scratch.Get "enableFooterSwitches" | default false -}}
3+
{{- $displayThemeToggle := site.Params.theme.displayToggle | default true -}}
4+
{{- $footerSwitchesVisible := and $enableFooterSwitches (or hugo.IsMultilingual $displayThemeToggle) -}}
5+
{{- $copyrightSectionVisible := or (.Site.Params.footer.displayPoweredBy | default true) .Site.Params.footer.displayCopyright -}}
6+
7+
{{- $copyright := (T "copyright") | default "© 2024 Hextra." -}}
8+
{{- $poweredBy := (T "poweredBy") | default "Powered by Hextra" -}}
9+
10+
{{- $footerWidth := "hx-max-w-screen-xl" -}}
11+
{{- with .Site.Params.footer.width -}}
12+
{{ if eq . "wide" -}}
13+
{{ $footerWidth = "hx-max-w-[90rem]" -}}
14+
{{ else if eq . "full" -}}
15+
{{ $footerWidth = "max-w-full" -}}
16+
{{ end -}}
17+
{{- end -}}
18+
19+
<footer class="hextra-footer hx-bg-gray-100 hx-pb-[env(safe-area-inset-bottom)] dark:hx-bg-neutral-900 print:hx-bg-transparent">
20+
{{- if $footerSwitchesVisible -}}
21+
<div class="hx-mx-auto hx-flex hx-gap-2 hx-py-2 hx-px-4 {{ $footerWidth }}">
22+
{{- partial "language-switch.html" (dict "context" .) -}}
23+
{{- with $displayThemeToggle }}{{ partial "theme-toggle.html" }}{{ end -}}
24+
</div>
25+
{{- if or hugo.IsMultilingual $displayThemeToggle -}}
26+
<hr class="dark:hx-border-neutral-800" />
27+
{{- end -}}
28+
{{- end -}}
29+
30+
{{- if $copyrightSectionVisible -}}
31+
<div class="hx-mx-auto hx-flex hx-items-center hx-justify-end hx-gap-2 hx-h-16 hx-px-6 hx-max-w-[90rem] hx-text-gray-600 dark:hx-text-gray-400">
32+
33+
<div class="hx-flex hx-items-center ltr:hx-mr-auto rtl:hx-ml-auto" >
34+
35+
{{- if .Site.Params.footer.displayCopyright }}
36+
<span class="hx-mr-2 hx-inline">{{ $copyright | markdownify }}</span>
37+
{{- end -}}
38+
39+
{{- if (.Site.Params.footer.displayPoweredBy | default true) }}
40+
<span class="hx-mr-2 hx-inline">{{ template "theme-credit" $poweredBy }}</span>
41+
{{- end -}}
42+
43+
</div>
44+
45+
{{- range .Site.Params.footer.links -}}
46+
{{- $external := strings.HasPrefix .url "http" -}}
47+
<a title="{{ .title }}" href="{{ .url }}" {{ if $external }}target="_blank"{{ end }} class="hx-text-sm contrast-more:hx-text-gray-700 contrast-more:dark:hx-text-gray-100 hx-relative -hx-ml-2 hx-whitespace-nowrap hx-p-2 md:hx-inline-block hx-text-gray-600 hover:hx-text-gray-800 dark:hx-text-gray-400 dark:hover:hx-text-gray-200">
48+
<span class="hx-text-center">
49+
{{- partial "utils/icon.html" (dict "name" .icon "attributes" "height=20") -}}
50+
</span>
51+
</a>
52+
{{- end -}}
53+
54+
</div>
55+
{{- end -}}
56+
</footer>
57+
58+
{{- define "theme-credit" -}}
59+
<a class="hx-flex hx-text-sm hx-items-center hx-gap-1 hx-text-current" target="_blank" rel="noopener noreferrer" title="Hextra GitHub Homepage" href="https://github.com/imfing/hextra">
60+
<span>
61+
{{- . | markdownify -}}
62+
{{- if strings.Contains . "Hextra" -}}
63+
{{- partial "utils/icon.html" (dict "name" "hextra" "attributes" `height=1em class="hx-inline-block ltr:hx-ml-1 rtl:hx-mr-1 hx-align-[-2.5px]"`) -}}
64+
{{- end -}}
65+
</span>
66+
</a>
67+
{{- end -}}

0 commit comments

Comments
 (0)