From eca76655718f9685c568a4e7791b2619638fc6af Mon Sep 17 00:00:00 2001
From: Xin <5097752+imfing@users.noreply.github.com>
Date: Thu, 14 Aug 2025 23:12:23 +0800
Subject: [PATCH] fix(page-width): add back page width override via css
variable (#748)
* fix(page-width): add back page width override via css variable
* refactor(css): update CSS variable references for site parameters
---
assets/css/variables.css | 6 +++---
layouts/_partials/head.html | 2 +-
layouts/_partials/utils/page-width-override.html | 7 +++++++
3 files changed, 11 insertions(+), 4 deletions(-)
create mode 100644 layouts/_partials/utils/page-width-override.html
diff --git a/assets/css/variables.css b/assets/css/variables.css
index 5cc96ac..8c41442 100644
--- a/assets/css/variables.css
+++ b/assets/css/variables.css
@@ -1,13 +1,13 @@
/* 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 -}}
+{{- $pageWidth := site.Params.page.width -}}
{{- $maxPageWidth := cond (eq $pageWidth "wide") "90rem" (cond (eq $pageWidth "full") "100%" "80rem") -}}
-{{- $navbarWidth := .Site.Params.navbar.width -}}
+{{- $navbarWidth := site.Params.navbar.width -}}
{{- $maxNavbarWidth := cond (eq $navbarWidth "wide") "90rem" (cond (eq $navbarWidth "full") "100%" "80rem") -}}
-{{- $footerWidth := .Site.Params.footer.width -}}
+{{- $footerWidth := site.Params.footer.width -}}
{{- $maxFooterWidth := cond (eq $footerWidth "wide") "90rem" (cond (eq $footerWidth "full") "100%" "80rem") -}}
*/
diff --git a/layouts/_partials/head.html b/layouts/_partials/head.html
index e3430ba..84c8df2 100644
--- a/layouts/_partials/head.html
+++ b/layouts/_partials/head.html
@@ -53,7 +53,6 @@
{{- end }}
-
{{- if and hugo.IsProduction .Site.Config.Services.GoogleAnalytics.ID }}
@@ -92,5 +91,6 @@
{{ partialCached "scripts/mathjax.html" . -}}
{{ end -}}
+ {{ partial "utils/page-width-override.html" . }}
{{ partial "custom/head-end.html" . -}}
diff --git a/layouts/_partials/utils/page-width-override.html b/layouts/_partials/utils/page-width-override.html
new file mode 100644
index 0000000..db13d05
--- /dev/null
+++ b/layouts/_partials/utils/page-width-override.html
@@ -0,0 +1,7 @@
+{{- with .Params.width -}}
+
+{{- end -}}