mirror of
https://github.com/imfing/hextra.git
synced 2025-07-01 18:37:24 -04:00
Compare commits
2 Commits
f98e9c3394
...
v0.9.1
Author | SHA1 | Date | |
---|---|---|---|
0716533699 | |||
9efcda2fdd |
@ -119,6 +119,7 @@ The following classes can be used to customize various parts of the theme.
|
||||
#### Footer
|
||||
|
||||
- `hextra-footer` - The footer element
|
||||
- `hextra-custom-footer` - The custom footer section container
|
||||
|
||||
#### Search
|
||||
|
||||
@ -184,6 +185,21 @@ You may add custom scripts to the end of the head for every page by adding the f
|
||||
layouts/partials/custom/head-end.html
|
||||
```
|
||||
|
||||
## Custom Footer Section
|
||||
|
||||
You can add a custom section the footer between the language/theme buttons and the "Copyright"/"Powered By" section by creating a file `layouts/partials/custom/footer.html` in your site.
|
||||
|
||||
```html {filename="layouts/partials/custom/footer.html"}
|
||||
<!-- Your footer element here -->
|
||||
```
|
||||
|
||||
Available variables in the footer section are:
|
||||
|
||||
- `.switchesVisible`: `true` if the language/theme button(s) are visible above the footer along with a horizontal separator.
|
||||
- `.copyrightVisible`: `true` if the "Copyright" and "Powered By" text are visible at the bottom of the footer.
|
||||
|
||||
_Note: The custom footer inherits the default footer background color text color and the `width` setting in `hugo.yaml#footer` section._
|
||||
|
||||
## Custom Layouts
|
||||
|
||||
The layouts of the theme can be overridden by creating a file with the same name in the `layouts` directory of your site.
|
||||
|
@ -173,3 +173,4 @@ params:
|
||||
# emitMetadata: 0
|
||||
# inputPosition: top
|
||||
# lang: en
|
||||
# theme: noborder_dark
|
||||
|
@ -228,6 +228,7 @@
|
||||
"hextra-code-block",
|
||||
"hextra-code-copy-btn",
|
||||
"hextra-code-copy-btn-container",
|
||||
"hextra-custom-footer",
|
||||
"hextra-feature-card",
|
||||
"hextra-feature-grid",
|
||||
"hextra-filetree",
|
||||
|
@ -8,9 +8,18 @@
|
||||
* This solution was created with reference to:
|
||||
* https://github.com/giscus/giscus/issues/336#issuecomment-1214366281
|
||||
*/
|
||||
function getGiscusTheme() {
|
||||
function getHugoTheme() {
|
||||
return localStorage.getItem("color-theme");
|
||||
}
|
||||
|
||||
function getGiscusTheme() {
|
||||
let giscusTheme = "{{ (string .theme) | default `light` }}";
|
||||
if(getHugoTheme() == 'light') {
|
||||
return giscusTheme.replace('dark', 'light');
|
||||
} else {
|
||||
return giscusTheme.replace('light', 'dark');
|
||||
}
|
||||
}
|
||||
|
||||
function setGiscusTheme() {
|
||||
function sendMessage(message) {
|
||||
|
0
layouts/partials/custom/footer.html
Normal file
0
layouts/partials/custom/footer.html
Normal file
@ -1,5 +1,7 @@
|
||||
{{- $enableFooterSwitches := .Scratch.Get "enableFooterSwitches" | default false -}}
|
||||
{{- $displayThemeToggle := site.Params.theme.displayToggle | default true -}}
|
||||
{{- $footerSwitchesVisible := and $enableFooterSwitches (or hugo.IsMultilingual $displayThemeToggle) -}}
|
||||
{{- $copyrightSectionVisible := or (.Site.Params.footer.displayPoweredBy | default true) .Site.Params.footer.displayCopyright -}}
|
||||
|
||||
{{- $copyright := (T "copyright") | default "© 2024 Hextra." -}}
|
||||
{{- $poweredBy := (T "poweredBy") | default "Powered by Hextra" -}}
|
||||
@ -15,7 +17,7 @@
|
||||
|
||||
|
||||
<footer class="hextra-footer hx-bg-gray-100 hx-pb-[env(safe-area-inset-bottom)] dark:hx-bg-neutral-900 print:hx-bg-transparent">
|
||||
{{- if and $enableFooterSwitches (or hugo.IsMultilingual $displayThemeToggle) -}}
|
||||
{{- if $footerSwitchesVisible -}}
|
||||
<div class="hx-mx-auto hx-flex hx-gap-2 hx-py-2 hx-px-4 {{ $footerWidth }}">
|
||||
{{- partial "language-switch.html" (dict "context" .) -}}
|
||||
{{- with $displayThemeToggle }}{{ partial "theme-toggle.html" }}{{ end -}}
|
||||
@ -24,14 +26,21 @@
|
||||
<hr class="dark:hx-border-neutral-800" />
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
<div
|
||||
class="{{ $footerWidth }} hx-mx-auto hx-flex hx-justify-center hx-py-12 hx-pl-[max(env(safe-area-inset-left),1.5rem)] hx-pr-[max(env(safe-area-inset-right),1.5rem)] hx-text-gray-600 dark:hx-text-gray-400 md:hx-justify-start"
|
||||
>
|
||||
<div class="hx-flex hx-w-full hx-flex-col hx-items-center sm:hx-items-start">
|
||||
{{- if (.Site.Params.footer.displayPoweredBy | default true) }}<div class="hx-font-semibold">{{ template "theme-credit" $poweredBy }}</div>{{ end }}
|
||||
{{- if .Site.Params.footer.displayCopyright }}<div class="hx-mt-6 hx-text-xs">{{ $copyright | markdownify }}</div>{{ end }}
|
||||
<div
|
||||
class="hextra-custom-footer {{ $footerWidth }} hx-pl-[max(env(safe-area-inset-left),1.5rem)] hx-pr-[max(env(safe-area-inset-right),1.5rem)] hx-text-gray-600 dark:hx-text-gray-400"
|
||||
>
|
||||
{{- partial "custom/footer.html" (dict "context" . "switchesVisible" $footerSwitchesVisible "copyrightVisible" $copyrightSectionVisible) -}}
|
||||
</div>
|
||||
</div>
|
||||
{{- if $copyrightSectionVisible -}}
|
||||
<div
|
||||
class="{{ $footerWidth }} hx-mx-auto hx-flex hx-justify-center hx-py-12 hx-pl-[max(env(safe-area-inset-left),1.5rem)] hx-pr-[max(env(safe-area-inset-right),1.5rem)] hx-text-gray-600 dark:hx-text-gray-400 md:hx-justify-start"
|
||||
>
|
||||
<div class="hx-flex hx-w-full hx-flex-col hx-items-center sm:hx-items-start">
|
||||
{{- if (.Site.Params.footer.displayPoweredBy | default true) }}<div class="hx-font-semibold">{{ template "theme-credit" $poweredBy }}</div>{{- end -}}
|
||||
{{- if .Site.Params.footer.displayCopyright }}<div class="hx-mt-6 hx-text-xs">{{ $copyright | markdownify }}</div>{{- end -}}
|
||||
</div>
|
||||
</div>
|
||||
{{- end -}}
|
||||
</footer>
|
||||
|
||||
{{- define "theme-credit" -}}
|
||||
|
Reference in New Issue
Block a user