fix(layout): make content width respect page.width config (#911)

Fixes #886 - The content area in `<main>` was hardcoded to `hx:max-w-6xl`
(72rem), ignoring the `params.page.width` setting. Added a new CSS
variable `--hextra-max-content-width` that responds to the page width
config, so users can now get full-width or wide content as expected.
This commit is contained in:
Xin
2026-01-24 00:02:50 +00:00
committed by GitHub
parent fa8f8554ea
commit 02cca4cd0b
13 changed files with 18 additions and 12 deletions

File diff suppressed because one or more lines are too long

View File

@@ -3,6 +3,7 @@
/* Do not remove the following comment. It is used by Hugo to render CSS variables.
{{- $pageWidth := site.Params.page.width -}}
{{- $maxPageWidth := cond (eq $pageWidth "wide") "90rem" (cond (eq $pageWidth "full") "100%" "80rem") -}}
{{- $maxContentWidth := cond (eq $pageWidth "wide") "80rem" (cond (eq $pageWidth "full") "100%" "72rem") -}}
{{- $navbarWidth := site.Params.navbar.width -}}
{{- $maxNavbarWidth := cond (eq $navbarWidth "wide") "90rem" (cond (eq $navbarWidth "full") "100%" "80rem") -}}
@@ -13,6 +14,7 @@
:root {
--hextra-max-page-width: {{ $maxPageWidth }};
--hextra-max-content-width: {{ $maxContentWidth }};
--hextra-max-navbar-width: {{ $maxNavbarWidth }};
--hextra-max-footer-width: {{ $maxFooterWidth }};
}
@@ -21,6 +23,10 @@
max-width: var(--hextra-max-page-width);
}
.hextra-max-content-width {
max-width: var(--hextra-max-content-width);
}
.hextra-max-navbar-width {
max-width: var(--hextra-max-navbar-width);
}