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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user