diff --git a/assets/css/variables.css b/assets/css/variables.css new file mode 100644 index 0000000..5cc96ac --- /dev/null +++ b/assets/css/variables.css @@ -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); +} 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" }} -