diff --git a/exampleSite/hugo.yaml b/exampleSite/hugo.yaml index 9c42586..f948971 100644 --- a/exampleSite/hugo.yaml +++ b/exampleSite/hugo.yaml @@ -122,7 +122,7 @@ params: width: wide page: - # full (100%), wide (90rem), normal (1280px) + # full (100%), wide (90rem), normal (80rem) width: normal theme: diff --git a/layouts/_default/list.html b/layouts/_default/list.html index ee041d6..653f6f1 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -1,5 +1,5 @@ {{ define "main" }} -
+
{{ partial "sidebar.html" (dict "context" .) }} {{ partial "toc.html" . }}
diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 6d52394..fe9f338 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,5 +1,5 @@ {{ define "main" }} -
+
{{ partial "sidebar.html" (dict "context" . "disableSidebar" true "displayPlaceholder" true) }} {{ partial "toc.html" . }}
diff --git a/layouts/_default/taxonomy.html b/layouts/_default/taxonomy.html index ea4b982..41add74 100644 --- a/layouts/_default/taxonomy.html +++ b/layouts/_default/taxonomy.html @@ -1,5 +1,5 @@ {{ define "main" }} -
+
{{ partial "sidebar.html" (dict "context" . "disableSidebar" true "displayPlaceholder" true) }} {{ partial "toc.html" (dict "Params" (dict "toc" false)) }}
diff --git a/layouts/_default/term.html b/layouts/_default/term.html index ed4c6a4..07ae191 100644 --- a/layouts/_default/term.html +++ b/layouts/_default/term.html @@ -1,5 +1,5 @@ {{ define "main" }} -
+
{{ partial "sidebar.html" (dict "context" . "disableSidebar" true "displayPlaceholder" true) }} {{ partial "toc.html" (dict "Params" (dict "toc" false)) }}
diff --git a/layouts/blog/list.html b/layouts/blog/list.html index 16dfa6e..5b2cad1 100644 --- a/layouts/blog/list.html +++ b/layouts/blog/list.html @@ -1,6 +1,6 @@ {{ define "main" }} {{- $readMore := (T "readMore") | default "Read more →" -}} -
+
{{ partial "sidebar.html" (dict "context" . "disableSidebar" true "displayPlaceholder" true) }}
diff --git a/layouts/blog/single.html b/layouts/blog/single.html index 009f755..605fd50 100644 --- a/layouts/blog/single.html +++ b/layouts/blog/single.html @@ -1,5 +1,5 @@ {{ define "main" }} -
+
{{ partial "sidebar.html" (dict "context" . "disableSidebar" true "displayPlaceholder" true) }} {{ partial "toc.html" . }}
diff --git a/layouts/docs/list.html b/layouts/docs/list.html index 9b9ca94..3c80126 100644 --- a/layouts/docs/list.html +++ b/layouts/docs/list.html @@ -1,5 +1,5 @@ {{ define "main" }} -
+
{{ partial "sidebar.html" (dict "context" .) }} {{ partial "toc.html" . }}
diff --git a/layouts/docs/single.html b/layouts/docs/single.html index 9b9ca94..3c80126 100644 --- a/layouts/docs/single.html +++ b/layouts/docs/single.html @@ -1,5 +1,5 @@ {{ define "main" }} -
+
{{ partial "sidebar.html" (dict "context" .) }} {{ partial "toc.html" . }}
diff --git a/layouts/hextra-home.html b/layouts/hextra-home.html index c0a27cf..8feb85f 100644 --- a/layouts/hextra-home.html +++ b/layouts/hextra-home.html @@ -1,5 +1,5 @@ {{ define "main" }} -
+
{{ partial "sidebar.html" (dict "context" . "disableSidebar" true) }}
diff --git a/layouts/index.html b/layouts/index.html index c4a8239..6353140 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -1,5 +1,5 @@ {{ define "main" }} -
+
{{ partial "sidebar.html" (dict "context" . "disableSidebar" true "displayPlaceholder" true) }} {{ partial "toc.html" . }}
diff --git a/layouts/partials/head-config-css.html b/layouts/partials/head-config-css.html new file mode 100644 index 0000000..a0d1ab5 --- /dev/null +++ b/layouts/partials/head-config-css.html @@ -0,0 +1,15 @@ +{{- $pageWidth := .Site.Params.page.width | default .Params.width -}} +{{- $maxPageWidth := cond (eq $pageWidth "wide") "90rem" (cond (eq $pageWidth "full") "100%" "80rem") -}} + + diff --git a/layouts/partials/head-css.html b/layouts/partials/head-css.html deleted file mode 100644 index d4f999f..0000000 --- a/layouts/partials/head-css.html +++ /dev/null @@ -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) }} - -{{- else }} - {{- $styles := resources.Get "css/compiled/main.css" -}} - - {{- if hugo.IsProduction }} - {{- $styles = $styles | minify | fingerprint }} - - - {{- else }} - - {{- end }} -{{- end }} - - - -{{- $custom := resources.Get "css/custom.css" }} -{{- if hugo.IsProduction -}} - {{- $custom = $custom | minify | fingerprint }} - -{{- else }} - -{{- end }} diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 0cfc083..7864de4 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -11,7 +11,7 @@ {{- if .IsHome -}} {{ .Site.Title -}} {{ else -}} - {{ with .Title }}{{ . }} – {{ end -}} + {{ with .Title }}{{ . }} –{{ end -}} {{ .Site.Title -}} {{ end -}} @@ -27,8 +27,33 @@ {{- template "_internal/schema.html" . -}} {{- template "_internal/twitter_cards.html" . -}} - {{- partialCached "head-css.html" . -}} + {{- partial "head-config-css.html" . -}} + {{- if and (not hugo.IsProduction) (eq hugo.Environment "theme") }} + {{- $styles := resources.Get "css/styles.css" }} + {{- $styles = $styles | postCSS (dict "inlineImports" true) }} + + {{- else }} + {{- $styles := resources.Get "css/compiled/main.css" -}} + + {{- if hugo.IsProduction }} + {{- $styles = $styles | minify | fingerprint }} + + + {{- else }} + + {{- end }} + {{- end }} + + + + {{- $custom := resources.Get "css/custom.css" }} + {{- if hugo.IsProduction -}} + {{- $custom = $custom | minify | fingerprint }} + + {{- else }} + + {{- end }} {{- if and (eq hugo.Environment "production") .Site.Config.Services.GoogleAnalytics.ID }} diff --git a/layouts/partials/utils/page-width.html b/layouts/partials/utils/page-width.html deleted file mode 100644 index 8ae1674..0000000 --- a/layouts/partials/utils/page-width.html +++ /dev/null @@ -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 }}