mirror of
https://github.com/imfing/hextra.git
synced 2025-06-19 09:23:37 -04:00
refactor: improve width handling and introduce CSS variables (#678)
* refactor: update page width handling and CSS structure - Changed the default page width from 1280px to 80rem in hugo.yaml. - Replaced dynamic page width partials with a new CSS class 'hextra-max-page-width' across multiple layout files for consistency. - Introduced a new head-config-css.html partial for managing CSS styles related to page width. - Removed the outdated page-width utility partial to streamline the codebase. * feat: introduce CSS variables for layout widths and update footer/navbar styles - Added a new configs.css file to define CSS variables for page, navbar, and footer widths. - Updated footer and navbar partials to utilize the new CSS classes for consistent width management. - Refactored head-config-css.html to include the new navbar width variable. - Enhanced the overall styling structure for better maintainability and responsiveness. * Refactor: Rename configs.css to variables.css and update references Remove head-config-css.html and update references to use variables.css instead of configs.css * Update assets/css/variables.css Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update layouts/partials/head.html Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
30
assets/css/variables.css
Normal file
30
assets/css/variables.css
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
/* Hugo template to derive CSS variables from site and page parameters */
|
||||||
|
|
||||||
|
/* Do not remove the following comment. It is used by Hugo to render CSS variables.
|
||||||
|
{{- $pageWidth := .Params.width | default .Site.Params.page.width -}}
|
||||||
|
{{- $maxPageWidth := cond (eq $pageWidth "wide") "90rem" (cond (eq $pageWidth "full") "100%" "80rem") -}}
|
||||||
|
|
||||||
|
{{- $navbarWidth := .Site.Params.navbar.width -}}
|
||||||
|
{{- $maxNavbarWidth := cond (eq $navbarWidth "wide") "90rem" (cond (eq $navbarWidth "full") "100%" "80rem") -}}
|
||||||
|
|
||||||
|
{{- $footerWidth := .Site.Params.footer.width -}}
|
||||||
|
{{- $maxFooterWidth := cond (eq $footerWidth "wide") "90rem" (cond (eq $footerWidth "full") "100%" "80rem") -}}
|
||||||
|
*/
|
||||||
|
|
||||||
|
:root {
|
||||||
|
--hextra-max-page-width: {{ $maxPageWidth }};
|
||||||
|
--hextra-max-navbar-width: {{ $maxNavbarWidth }};
|
||||||
|
--hextra-max-footer-width: {{ $maxFooterWidth }};
|
||||||
|
}
|
||||||
|
|
||||||
|
.hextra-max-page-width {
|
||||||
|
max-width: var(--hextra-max-page-width);
|
||||||
|
}
|
||||||
|
|
||||||
|
.hextra-max-navbar-width {
|
||||||
|
max-width: var(--hextra-max-navbar-width);
|
||||||
|
}
|
||||||
|
|
||||||
|
.hextra-max-footer-width {
|
||||||
|
max-width: var(--hextra-max-footer-width);
|
||||||
|
}
|
@ -122,7 +122,7 @@ params:
|
|||||||
width: wide
|
width: wide
|
||||||
|
|
||||||
page:
|
page:
|
||||||
# full (100%), wide (90rem), normal (1280px)
|
# full (100%), wide (90rem), normal (80rem)
|
||||||
width: normal
|
width: normal
|
||||||
|
|
||||||
theme:
|
theme:
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{{ define "main" }}
|
{{ define "main" }}
|
||||||
<div class='hx:mx-auto hx:flex {{ partial "utils/page-width" . }}'>
|
<div class='hx:mx-auto hx:flex hextra-max-page-width'>
|
||||||
{{ partial "sidebar.html" (dict "context" .) }}
|
{{ partial "sidebar.html" (dict "context" .) }}
|
||||||
{{ partial "toc.html" . }}
|
{{ partial "toc.html" . }}
|
||||||
<article class="hx:w-full hx:break-words hx:flex hx:min-h-[calc(100vh-var(--navbar-height))] hx:min-w-0 hx:justify-center hx:pb-8 hx:pr-[calc(env(safe-area-inset-right)-1.5rem)]">
|
<article class="hx:w-full hx:break-words hx:flex hx:min-h-[calc(100vh-var(--navbar-height))] hx:min-w-0 hx:justify-center hx:pb-8 hx:pr-[calc(env(safe-area-inset-right)-1.5rem)]">
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{{ define "main" }}
|
{{ define "main" }}
|
||||||
<div class='hx:mx-auto hx:flex {{ partial "utils/page-width" . }}'>
|
<div class='hx:mx-auto hx:flex hextra-max-page-width'>
|
||||||
{{ partial "sidebar.html" (dict "context" . "disableSidebar" true "displayPlaceholder" true) }}
|
{{ partial "sidebar.html" (dict "context" . "disableSidebar" true "displayPlaceholder" true) }}
|
||||||
{{ partial "toc.html" . }}
|
{{ partial "toc.html" . }}
|
||||||
<article class="hx:w-full hx:break-words hx:flex hx:min-h-[calc(100vh-var(--navbar-height))] hx:min-w-0 hx:justify-center hx:pb-8 hx:pr-[calc(env(safe-area-inset-right)-1.5rem)]">
|
<article class="hx:w-full hx:break-words hx:flex hx:min-h-[calc(100vh-var(--navbar-height))] hx:min-w-0 hx:justify-center hx:pb-8 hx:pr-[calc(env(safe-area-inset-right)-1.5rem)]">
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{{ define "main" }}
|
{{ define "main" }}
|
||||||
<div class='hx:mx-auto hx:flex {{ partial "utils/page-width" . }}'>
|
<div class='hx:mx-auto hx:flex hextra-max-page-width'>
|
||||||
{{ partial "sidebar.html" (dict "context" . "disableSidebar" true "displayPlaceholder" true) }}
|
{{ partial "sidebar.html" (dict "context" . "disableSidebar" true "displayPlaceholder" true) }}
|
||||||
{{ partial "toc.html" (dict "Params" (dict "toc" false)) }}
|
{{ partial "toc.html" (dict "Params" (dict "toc" false)) }}
|
||||||
<article class="hx:w-full hx:break-words hx:flex hx:min-h-[calc(100vh-var(--navbar-height))] hx:min-w-0 hx:justify-center hx:pb-8 hx:pr-[calc(env(safe-area-inset-right)-1.5rem)]">
|
<article class="hx:w-full hx:break-words hx:flex hx:min-h-[calc(100vh-var(--navbar-height))] hx:min-w-0 hx:justify-center hx:pb-8 hx:pr-[calc(env(safe-area-inset-right)-1.5rem)]">
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{{ define "main" }}
|
{{ define "main" }}
|
||||||
<div class='hx:mx-auto hx:flex {{ partial "utils/page-width" . }}'>
|
<div class='hx:mx-auto hx:flex hextra-max-page-width'>
|
||||||
{{ partial "sidebar.html" (dict "context" . "disableSidebar" true "displayPlaceholder" true) }}
|
{{ partial "sidebar.html" (dict "context" . "disableSidebar" true "displayPlaceholder" true) }}
|
||||||
{{ partial "toc.html" (dict "Params" (dict "toc" false)) }}
|
{{ partial "toc.html" (dict "Params" (dict "toc" false)) }}
|
||||||
<article class="hx:w-full hx:break-words hx:flex hx:min-h-[calc(100vh-var(--navbar-height))] hx:min-w-0 hx:justify-center hx:pb-8 hx:pr-[calc(env(safe-area-inset-right)-1.5rem)]">
|
<article class="hx:w-full hx:break-words hx:flex hx:min-h-[calc(100vh-var(--navbar-height))] hx:min-w-0 hx:justify-center hx:pb-8 hx:pr-[calc(env(safe-area-inset-right)-1.5rem)]">
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{{ define "main" }}
|
{{ define "main" }}
|
||||||
{{- $readMore := (T "readMore") | default "Read more →" -}}
|
{{- $readMore := (T "readMore") | default "Read more →" -}}
|
||||||
<div class="hx:mx-auto hx:flex {{ partial `utils/page-width` . }}">
|
<div class="hx:mx-auto hx:flex hextra-max-page-width">
|
||||||
{{ partial "sidebar.html" (dict "context" . "disableSidebar" true "displayPlaceholder" true) }}
|
{{ partial "sidebar.html" (dict "context" . "disableSidebar" true "displayPlaceholder" true) }}
|
||||||
<article class="hx:w-full hx:break-words hx:flex hx:min-h-[calc(100vh-var(--navbar-height))] hx:min-w-0 hx:justify-center hx:pb-8 hx:pr-[calc(env(safe-area-inset-right)-1.5rem)]">
|
<article class="hx:w-full hx:break-words hx:flex hx:min-h-[calc(100vh-var(--navbar-height))] hx:min-w-0 hx:justify-center hx:pb-8 hx:pr-[calc(env(safe-area-inset-right)-1.5rem)]">
|
||||||
<main class="hx:w-full hx:min-w-0 hx:max-w-6xl hx:px-6 hx:pt-4 hx:md:px-12">
|
<main class="hx:w-full hx:min-w-0 hx:max-w-6xl hx:px-6 hx:pt-4 hx:md:px-12">
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{{ define "main" }}
|
{{ define "main" }}
|
||||||
<div class="hx:mx-auto hx:flex {{ partial `utils/page-width` . }}">
|
<div class="hx:mx-auto hx:flex hextra-max-page-width">
|
||||||
{{ partial "sidebar.html" (dict "context" . "disableSidebar" true "displayPlaceholder" true) }}
|
{{ partial "sidebar.html" (dict "context" . "disableSidebar" true "displayPlaceholder" true) }}
|
||||||
{{ partial "toc.html" . }}
|
{{ partial "toc.html" . }}
|
||||||
<article class="hx:w-full hx:break-words hx:flex hx:min-h-[calc(100vh-var(--navbar-height))] hx:min-w-0 hx:justify-center hx:pb-8 hx:pr-[calc(env(safe-area-inset-right)-1.5rem)]">
|
<article class="hx:w-full hx:break-words hx:flex hx:min-h-[calc(100vh-var(--navbar-height))] hx:min-w-0 hx:justify-center hx:pb-8 hx:pr-[calc(env(safe-area-inset-right)-1.5rem)]">
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{{ define "main" }}
|
{{ define "main" }}
|
||||||
<div class='hx:mx-auto hx:flex {{ partial "utils/page-width" . }}'>
|
<div class='hx:mx-auto hx:flex hextra-max-page-width'>
|
||||||
{{ partial "sidebar.html" (dict "context" .) }}
|
{{ partial "sidebar.html" (dict "context" .) }}
|
||||||
{{ partial "toc.html" . }}
|
{{ partial "toc.html" . }}
|
||||||
<article class="hx:w-full hx:break-words hx:flex hx:min-h-[calc(100vh-var(--navbar-height))] hx:min-w-0 hx:justify-center hx:pb-8 hx:pr-[calc(env(safe-area-inset-right)-1.5rem)]">
|
<article class="hx:w-full hx:break-words hx:flex hx:min-h-[calc(100vh-var(--navbar-height))] hx:min-w-0 hx:justify-center hx:pb-8 hx:pr-[calc(env(safe-area-inset-right)-1.5rem)]">
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{{ define "main" }}
|
{{ define "main" }}
|
||||||
<div class='hx:mx-auto hx:flex {{ partial "utils/page-width" . }}'>
|
<div class='hx:mx-auto hx:flex hextra-max-page-width'>
|
||||||
{{ partial "sidebar.html" (dict "context" .) }}
|
{{ partial "sidebar.html" (dict "context" .) }}
|
||||||
{{ partial "toc.html" . }}
|
{{ partial "toc.html" . }}
|
||||||
<article class="hx:w-full hx:break-words hx:flex hx:min-h-[calc(100vh-var(--navbar-height))] hx:min-w-0 hx:justify-center hx:pb-8 hx:pr-[calc(env(safe-area-inset-right)-1.5rem)]">
|
<article class="hx:w-full hx:break-words hx:flex hx:min-h-[calc(100vh-var(--navbar-height))] hx:min-w-0 hx:justify-center hx:pb-8 hx:pr-[calc(env(safe-area-inset-right)-1.5rem)]">
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{{ define "main" }}
|
{{ define "main" }}
|
||||||
<div class='hx:mx-auto hx:flex {{ partial "utils/page-width" . }}'>
|
<div class='hx:mx-auto hx:flex hextra-max-page-width'>
|
||||||
{{ partial "sidebar.html" (dict "context" . "disableSidebar" true) }}
|
{{ partial "sidebar.html" (dict "context" . "disableSidebar" true) }}
|
||||||
<div class="hx:w-full hx:break-words hx:min-h-[calc(100vh-var(--navbar-height))] hx:min-w-0 hx:pb-8 hx:pt-8 hx:md:pt-12 hx:pl-[max(env(safe-area-inset-left),1.5rem)] hx:pr-[max(env(safe-area-inset-left),1.5rem)]">
|
<div class="hx:w-full hx:break-words hx:min-h-[calc(100vh-var(--navbar-height))] hx:min-w-0 hx:pb-8 hx:pt-8 hx:md:pt-12 hx:pl-[max(env(safe-area-inset-left),1.5rem)] hx:pr-[max(env(safe-area-inset-left),1.5rem)]">
|
||||||
<div class="hx:flex hx:flex-col hx:items-start">
|
<div class="hx:flex hx:flex-col hx:items-start">
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{{ define "main" }}
|
{{ define "main" }}
|
||||||
<div class='hx:mx-auto hx:flex {{ partial "utils/page-width" . }}'>
|
<div class='hx:mx-auto hx:flex hextra-max-page-width'>
|
||||||
{{ partial "sidebar.html" (dict "context" . "disableSidebar" true "displayPlaceholder" true) }}
|
{{ partial "sidebar.html" (dict "context" . "disableSidebar" true "displayPlaceholder" true) }}
|
||||||
{{ partial "toc.html" . }}
|
{{ partial "toc.html" . }}
|
||||||
<article class="hx:w-full hx:break-words hx:flex hx:min-h-[calc(100vh-var(--navbar-height))] hx:min-w-0 hx:justify-center hx:pb-8 hx:pr-[calc(env(safe-area-inset-right)-1.5rem)]">
|
<article class="hx:w-full hx:break-words hx:flex hx:min-h-[calc(100vh-var(--navbar-height))] hx:min-w-0 hx:justify-center hx:pb-8 hx:pr-[calc(env(safe-area-inset-right)-1.5rem)]">
|
||||||
|
@ -6,19 +6,10 @@
|
|||||||
{{- $copyright := (T "copyright") | default "© 2024 Hextra." -}}
|
{{- $copyright := (T "copyright") | default "© 2024 Hextra." -}}
|
||||||
{{- $poweredBy := (T "poweredBy") | default "Powered by Hextra" -}}
|
{{- $poweredBy := (T "poweredBy") | default "Powered by Hextra" -}}
|
||||||
|
|
||||||
{{- $footerWidth := "hx:max-w-screen-xl" -}}
|
|
||||||
{{- with .Site.Params.footer.width -}}
|
|
||||||
{{ if eq . "wide" -}}
|
|
||||||
{{ $footerWidth = "hx:max-w-[90rem]" -}}
|
|
||||||
{{ else if eq . "full" -}}
|
|
||||||
{{ $footerWidth = "max-w-full" -}}
|
|
||||||
{{ end -}}
|
|
||||||
{{- end -}}
|
|
||||||
|
|
||||||
|
|
||||||
<footer class="hextra-footer hx:bg-gray-100 hx:pb-[env(safe-area-inset-bottom)] hx:dark:bg-neutral-900 hx:print:bg-transparent">
|
<footer class="hextra-footer hx:bg-gray-100 hx:pb-[env(safe-area-inset-bottom)] hx:dark:bg-neutral-900 hx:print:bg-transparent">
|
||||||
{{- if $footerSwitchesVisible -}}
|
{{- if $footerSwitchesVisible -}}
|
||||||
<div class="hx:mx-auto hx:flex hx:gap-2 hx:py-2 hx:px-4 {{ $footerWidth }}">
|
<div class="hx:mx-auto hx:flex hx:gap-2 hx:py-2 hx:px-4 hextra-max-footer-width">
|
||||||
{{- partial "language-switch.html" (dict "context" .) -}}
|
{{- partial "language-switch.html" (dict "context" .) -}}
|
||||||
{{- with $displayThemeToggle }}{{ partial "theme-toggle.html" }}{{ end -}}
|
{{- with $displayThemeToggle }}{{ partial "theme-toggle.html" }}{{ end -}}
|
||||||
</div>
|
</div>
|
||||||
@ -26,21 +17,19 @@
|
|||||||
<hr class="hx:border-gray-200 hx:dark:border-neutral-800" />
|
<hr class="hx:border-gray-200 hx:dark:border-neutral-800" />
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
<div class="hextra-custom-footer hextra-max-footer-width hx:pl-[max(env(safe-area-inset-left),1.5rem)] hx:pr-[max(env(safe-area-inset-right),1.5rem)] hx:text-gray-600 hx:dark:text-gray-400">
|
||||||
|
{{- partial "custom/footer.html" (dict "context" . "switchesVisible" $footerSwitchesVisible "copyrightVisible" $copyrightSectionVisible) -}}
|
||||||
|
</div>
|
||||||
|
{{- if $copyrightSectionVisible -}}
|
||||||
<div
|
<div
|
||||||
class="hextra-custom-footer {{ $footerWidth }} hx:mx-auto hx:pl-[max(env(safe-area-inset-left),1.5rem)] hx:pr-[max(env(safe-area-inset-right),1.5rem)] hx:text-gray-600 hx:dark:text-gray-400"
|
class="hextra-max-footer-width 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 hx:dark:text-gray-400 hx:md:justify-start"
|
||||||
>
|
>
|
||||||
{{- partial "custom/footer.html" (dict "context" . "switchesVisible" $footerSwitchesVisible "copyrightVisible" $copyrightSectionVisible) -}}
|
<div class="hx:flex hx:w-full hx:flex-col hx:items-center hx:sm:items-start">
|
||||||
</div>
|
{{- if (.Site.Params.footer.displayPoweredBy | default true) }}<div class="hx:font-semibold">{{ template "theme-credit" $poweredBy }}</div>{{- end -}}
|
||||||
{{- if $copyrightSectionVisible -}}
|
{{- if .Site.Params.footer.displayCopyright }}<div class="hx:mt-6 hx:text-xs">{{ $copyright | markdownify }}</div>{{- 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 hx:dark:text-gray-400 hx:md:justify-start"
|
|
||||||
>
|
|
||||||
<div class="hx:flex hx:w-full hx:flex-col hx:items-center hx:sm: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>
|
</div>
|
||||||
{{- end -}}
|
</div>
|
||||||
|
{{- end -}}
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
{{- define "theme-credit" -}}
|
{{- define "theme-credit" -}}
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
{{- if and (not hugo.IsProduction) (eq hugo.Environment "theme") }}
|
|
||||||
{{- $styles := resources.Get "css/styles.css" }}
|
|
||||||
{{- $styles = $styles | postCSS (dict "inlineImports" true) }}
|
|
||||||
<link href="{{ $styles.RelPermalink }}" rel="stylesheet" />
|
|
||||||
{{- else }}
|
|
||||||
{{- $styles := resources.Get "css/compiled/main.css" -}}
|
|
||||||
|
|
||||||
{{- if hugo.IsProduction }}
|
|
||||||
{{- $styles = $styles | minify | fingerprint }}
|
|
||||||
<link rel="preload" href="{{ $styles.RelPermalink }}" as="style" integrity="{{ $styles.Data.Integrity }}" />
|
|
||||||
<link href="{{ $styles.RelPermalink }}" rel="stylesheet" integrity="{{ $styles.Data.Integrity }}" />
|
|
||||||
{{- else }}
|
|
||||||
<link href="{{ $styles.RelPermalink }}" rel="stylesheet" />
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Custom CSS -->
|
|
||||||
{{- $custom := resources.Get "css/custom.css" }}
|
|
||||||
{{- if hugo.IsProduction -}}
|
|
||||||
{{- $custom = $custom | minify | fingerprint }}
|
|
||||||
<link href="{{ $custom.RelPermalink }}" rel="stylesheet" integrity="{{ $custom.Data.Integrity }}" />
|
|
||||||
{{- else }}
|
|
||||||
<link href="{{ $custom.RelPermalink }}" rel="stylesheet" />
|
|
||||||
{{- end }}
|
|
@ -12,7 +12,7 @@
|
|||||||
{{- if .IsHome -}}
|
{{- if .IsHome -}}
|
||||||
{{ .Site.Title -}}
|
{{ .Site.Title -}}
|
||||||
{{ else -}}
|
{{ else -}}
|
||||||
{{ with .Title }}{{ . }} – {{ end -}}
|
{{ with .Title }}{{ . }} –{{ end -}}
|
||||||
{{ .Site.Title -}}
|
{{ .Site.Title -}}
|
||||||
{{ end -}}
|
{{ end -}}
|
||||||
</title>
|
</title>
|
||||||
@ -28,13 +28,26 @@
|
|||||||
{{- template "_internal/schema.html" . -}}
|
{{- template "_internal/schema.html" . -}}
|
||||||
{{- template "_internal/twitter_cards.html" . -}}
|
{{- template "_internal/twitter_cards.html" . -}}
|
||||||
|
|
||||||
{{- partialCached "head-css.html" . -}}
|
{{- $mainCss := resources.Get "css/compiled/main.css" -}}
|
||||||
|
{{- $customCss := resources.Get "css/custom.css" -}}
|
||||||
|
{{- $variablesCss := resources.Get "css/variables.css" | resources.ExecuteAsTemplate "css/variables.css" . -}}
|
||||||
|
|
||||||
|
{{- if hugo.IsProduction }}
|
||||||
|
{{- $styles := slice $variablesCss $mainCss $customCss | resources.Concat "css/compiled/main.css" | minify | fingerprint }}
|
||||||
|
<link rel="preload" href="{{ $styles.RelPermalink }}" as="style" integrity="{{ $styles.Data.Integrity }}" />
|
||||||
|
<link href="{{ $styles.RelPermalink }}" rel="stylesheet" integrity="{{ $styles.Data.Integrity }}" />
|
||||||
|
{{- else }}
|
||||||
|
{{- $styles := resources.Get "css/styles.css" | postCSS (dict "inlineImports" true) }}
|
||||||
|
<link href="{{ $styles.RelPermalink }}" rel="stylesheet" />
|
||||||
|
<link href="{{ $variablesCss.RelPermalink }}" rel="stylesheet" />
|
||||||
|
<link href="{{ $customCss.RelPermalink }}" rel="stylesheet" />
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
|
||||||
<!-- Google Analytics -->
|
<!-- Google Analytics -->
|
||||||
{{- if and (eq hugo.Environment "production") .Site.Config.Services.GoogleAnalytics.ID }}
|
{{- if and hugo.IsProduction .Site.Config.Services.GoogleAnalytics.ID }}
|
||||||
<link rel="preconnect" href="https://www.googletagmanager.com" crossorigin />
|
<link rel="preconnect" href="https://www.googletagmanager.com" crossorigin />
|
||||||
{{ partial "google-analytics.html" . }}
|
{{ partial "google-analytics.html" . -}}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
<div class="nav-container hx:sticky hx:top-0 hx:z-20 hx:w-full hx:bg-transparent hx:print:hidden">
|
<div class="nav-container hx:sticky hx:top-0 hx:z-20 hx:w-full hx:bg-transparent hx:print:hidden">
|
||||||
<div class="nav-container-blur hx:pointer-events-none hx:absolute hx:z-[-1] hx:h-full hx:w-full hx:bg-white hx:dark:bg-dark hx:shadow-[0_2px_4px_rgba(0,0,0,.02),0_1px_0_rgba(0,0,0,.06)] hx:contrast-more:shadow-[0_0_0_1px_#000] hx:dark:shadow-[0_-1px_0_rgba(255,255,255,.1)_inset] hx:contrast-more:dark:shadow-[0_0_0_1px_#fff]"></div>
|
<div class="nav-container-blur hx:pointer-events-none hx:absolute hx:z-[-1] hx:h-full hx:w-full hx:bg-white hx:dark:bg-dark hx:shadow-[0_2px_4px_rgba(0,0,0,.02),0_1px_0_rgba(0,0,0,.06)] hx:contrast-more:shadow-[0_0_0_1px_#000] hx:dark:shadow-[0_-1px_0_rgba(255,255,255,.1)_inset] hx:contrast-more:dark:shadow-[0_0_0_1px_#fff]"></div>
|
||||||
|
|
||||||
<nav class="hx:mx-auto hx:flex hx:items-center hx:justify-end hx:gap-2 hx:h-16 hx:px-6 {{ $navWidth }}">
|
<nav class="hextra-max-navbar-width hx:mx-auto hx:flex hx:items-center hx:justify-end hx:gap-2 hx:h-16 hx:px-6">
|
||||||
<a class="hx:flex hx:items-center hx:hover:opacity-75 hx:ltr:mr-auto hx:rtl:ml-auto" href="{{ $logoLink }}">
|
<a class="hx:flex hx:items-center hx:hover:opacity-75 hx:ltr:mr-auto hx:rtl:ml-auto" href="{{ $logoLink }}">
|
||||||
{{- if (.Site.Params.navbar.displayLogo | default true) }}
|
{{- if (.Site.Params.navbar.displayLogo | default true) }}
|
||||||
<img class="hx:mr-2 hx:block hx:dark:hidden" src="{{ $logoPath | relURL }}" alt="{{ .Site.Title }}" height="{{ $logoHeight }}" width="{{ $logoWidth }}" />
|
<img class="hx:mr-2 hx:block hx:dark:hidden" src="{{ $logoPath | relURL }}" alt="{{ .Site.Title }}" height="{{ $logoHeight }}" width="{{ $logoWidth }}" />
|
||||||
|
@ -1,27 +0,0 @@
|
|||||||
{{/* Get page width from site configuration */}}
|
|
||||||
|
|
||||||
{{/* Default page width */}}
|
|
||||||
{{- $pageWidth := "" -}}
|
|
||||||
|
|
||||||
{{/* Get page width setting from page front matter or site params */}}
|
|
||||||
{{ with .Params.width -}}
|
|
||||||
{{ $pageWidth = . -}}
|
|
||||||
{{ else -}}
|
|
||||||
{{ with .Site.Params.page.width -}}
|
|
||||||
{{ $pageWidth = . -}}
|
|
||||||
{{ end -}}
|
|
||||||
{{ end -}}
|
|
||||||
|
|
||||||
{{- with $pageWidth -}}
|
|
||||||
{{ if eq . "wide" -}}
|
|
||||||
{{ $pageWidth = "hx:max-w-[90rem]" -}}
|
|
||||||
{{ else if eq . "full" -}}
|
|
||||||
{{ $pageWidth = "max-w-full" -}}
|
|
||||||
{{ else -}}
|
|
||||||
{{ $pageWidth = "hx:max-w-screen-xl" -}}
|
|
||||||
{{ end -}}
|
|
||||||
{{ else -}}
|
|
||||||
{{ $pageWidth = "hx:max-w-screen-xl" -}}
|
|
||||||
{{ end -}}
|
|
||||||
|
|
||||||
{{ return $pageWidth }}
|
|
Reference in New Issue
Block a user