1 Commits

Author SHA1 Message Date
00a0f64be4 WIP body-module and smarter usage of container divs 2025-08-22 12:11:24 -05:00
20 changed files with 246 additions and 253 deletions

View File

@@ -174,6 +174,30 @@ video {
max-width: 100%;
}
figure > .figure-media {
padding: 5px;
}
figure > .figure-media.border {
border: 2px solid var(--figure-border);
}
.post-media > figure > .figure-media {
border: 7px solid var(--figure-border);
}
figure {
display: block;
text-align: center;
margin: 0;
}
figcaption {
font-style: italic;
font-size: small;
text-align: center;
}
a {
color: var(--link-0);
text-decoration: inherit;
@@ -269,22 +293,40 @@ body {
color: var(--text-0);
overflow-wrap: break-word;
margin: 0;
display: flex;
flex-direction: column;
align-items: center;
gap: var(--page-margin);
}
.main-container {
margin: var(--page-margin) auto;
/* use padding because otherwise there's no way to have margin be both auto, and a minimum value */
padding: 0 var(--page-margin);
max-width: calc(720px + 2 * var(--page-margin)); /* padding is included in the element's width */
.body-module {
width: 100%; /* without, it collapses inside flexbox for some reason TODO: figure out why */
}
.site-footer {
margin: var(--page-margin) 0;
.body-module--marginless {
margin: 0;
}
.body-module--full-width {
margin: 0 var(--page-margin);
/*
margin-left: var(--page-margin);
margin-right: var(--page-margin);
*/
}
.body-module--wide {
margin-left: var(--page-margin);
margin-right: var(--page-margin);
max-width: 720px;
}
footer {
margin-bottom: var(--page-margin);
text-align: center;
font-size: smaller;
}
.site-footer p {
footer p {
margin: 0;
}
@@ -316,7 +358,7 @@ body {
* or it will need its hover background to be chopped off on the left */
}
.top-brand {
.brand {
flex-grow: 1;
margin: 8px var(--page-margin);
font-size: 1.25em;
@@ -324,27 +366,27 @@ body {
align-items: center;
}
.top-brand > a {
.brand a {
color: inherit;
font-weight: bold;
}
.top-navbar {
.navbar {
display: flex;
flex-wrap: wrap;
}
.top-navbar-item {
.navbar-item {
padding: 12px var(--page-margin);
white-space: nowrap;
}
.top-navbar-item:hover {
.navbar-item:hover {
background-color: var(--background-2);
text-decoration: none;
}
.top-navbar-item--active {
.navbar-item.active {
font-weight: bold;
}
@@ -352,10 +394,6 @@ body {
/* Breadcrumb navigation {{{ */
.breadcrumb {
margin: var(--page-margin) 0;
}
.breadcrumb ul {
margin: 0;
padding: 0;
@@ -420,26 +458,33 @@ body {
/* }}} */
/* Summary card formatting {{{ */
/* List layout {{{ */
.summary-card {
/* flexbox container for sections and main page list */
.list-page-container {
display: flex;
flex-direction: column;
gap: 40px;
}
.page-list {
display: flex;
flex-direction: column;
list-style: none;
padding: 0;
gap: 40px;
margin-top: 16px;
}
.page-list > .page {
padding: 24px;
border-radius: 12px;
background-color: var(--background-1);
color: var(--text-1);
}
.summary-card-title {
.page > .page-title {
margin-top: 0;
margin-bottom: 10px;
}
.summary-card-title a {
color: inherit;
}
.summary-card-title h1 {
margin: 0;
}
/* hugo just can't handle this feature
@@ -450,6 +495,18 @@ body {
}
*/
.page-title {
margin-bottom: 10px;
}
.page-title a {
color: inherit;
}
.page-title h1 {
margin: 0;
}
.page-metadata {
margin-bottom: 24px;
}
@@ -471,74 +528,20 @@ body {
content: ",";
}
/* for formatting of the featured image/media, see the .featured-media class */
.post-media {
margin-top: 15px;
}
.summary-card-description {
.page-description {
margin-top: 10px;
}
.summary-card-readmore {
.readmore {
margin-top: 5px;
}
/* }}} */
/* Figures, and featured media component (used in page.html and summary-card) {{{ */
figure > .figure-media {
padding: 5px;
}
figure > .figure-media.border {
border: 2px solid var(--figure-border);
}
figure {
display: block;
text-align: center;
margin: 0;
}
figcaption {
font-style: italic;
font-size: small;
text-align: center;
}
.featured-media {
margin-top: 15px;
}
.featured-media > figure > .figure-media {
border: 7px solid var(--figure-border);
}
/* }}} */
/* List layout {{{ */
.page-list {
display: flex;
flex-direction: column;
list-style: none;
padding: 0;
gap: 40px;
margin-top: 16px;
}
.page-title {
margin-bottom: 10px;
}
.page-title a {
color: inherit;
}
.page-title h1 {
margin: 0;
}
/* }}} */
/* Taxonomy list layout {{{ */
.taxonomy-list a,
@@ -589,11 +592,17 @@ figcaption {
/* Series list layout {{{ */
.page-list--series {
.page-list.series {
display: flex;
gap: 80px;
flex-flow: row wrap;
list-style: none;
color: var(--text-0);
padding: 8px;
border-radius: 16px;
}
.page-list--series-inner {
.page-list.series-inner {
gap: 10px;
flex-direction: row;
flex-flow: row wrap;
@@ -602,7 +611,7 @@ figcaption {
padding: 8px;
border-radius: 16px;
}
.page-list--series-inner > .summary-card {
.page-list.series-inner > .page {
flex: 1;
min-width: 49%;
}
@@ -612,7 +621,6 @@ figcaption {
/* Subsections on list pages {{{ */
.sections {
margin-bottom: 60px;
display: flex;
flex-direction: column;
gap: 10px;
@@ -623,9 +631,6 @@ figcaption {
color: var(--text-1);
border-radius: 12px;
padding: 1px 25px;
display: flex;
flex-direction: row;
justify-content: space-between;
}
.section:hover {
@@ -649,16 +654,6 @@ figcaption {
margin-bottom: 5px;
}
.section-arrow {
margin-block: auto;
max-height: fit-content;
float: right;
}
.section-arrow > .icon {
height: 48px;
width: 48px;
}
/* }}} */
@@ -788,16 +783,16 @@ figcaption {
margin: var(--page-margin);
}
.related-posts .summary-card {
.related-posts .page {
min-width: 300px;
max-width: 300px;
}
.related-posts .summary-card:first-child {
.related-posts .page:first-child {
margin-left: var(--page-margin);
}
.related-posts .summary-card:last-child {
.related-posts .page:last-child {
margin-right: var(--page-margin);
}

View File

@@ -48,8 +48,6 @@ post_count:
# Navigation
read_more:
other: "Read more"
see_posts:
other: "See posts"
related_posts:
other: "Related Posts"

View File

@@ -0,0 +1,4 @@
{{/*
Create a file named `layouts/partials/additional-head.html` at your site root to
add extra tags into <head>. Page variables are passed.
*/}}

View File

@@ -1,4 +1,4 @@
<nav class="breadcrumb" aria-label="{{ i18n "aria_breadcrumbnav" }}">
<nav class="body-module body-module--wide breadcrumb" aria-label="{{ i18n "aria_breadcrumbnav" }}">
<ul>
{{ template "breadcrumbnav" (dict "p1" . "p2" .) }}
</ul>

View File

@@ -1,5 +1,5 @@
{{ with .Resources.Get "feature" }}
<div class="featured-media">
<div class="post-media">
<figure>
{{ partial "embed-resource.html" . }}
{{ with .Title }}

View File

@@ -1,7 +1,9 @@
<div class="page-list">
{{ with . }}
{{ range . }}
{{ .Render "summary" }}
<article class="page">
{{ .Render "summary" }}
</article>
{{ end }}
{{ else }}
<div>

View File

@@ -1,5 +1,5 @@
{{ if or .Date .Params.authors .Site.Params.readingtime .Site.Params.gitFileURL }}
<section class="page-metadata" aria-label="{{ i18n "aria_post_metadata" }}">
<div class="page-metadata" aria-label="{{ i18n "aria_post_metadata" }}">
{{ if .Date }}
<span class="page-metadata-item" aria-label="{{ i18n "aria_post_meta_date" }}">
{{ partial "icon.html" "calendar" }}
@@ -26,5 +26,5 @@
{{ partial "page-metadata/item/categories.html" . }}
{{ partial "page-metadata/item/tags.html" . }}
</section>
</div>
{{ end }}

View File

@@ -1,5 +1,5 @@
{{ if or .Date .Params.authors .Site.Params.readingtime }}
<section class="page-metadata" aria-label="{{ i18n "aria_post_metadata" }}">
<div class="page-metadata" aria-label="{{ i18n "aria_post_metadata" }}">
{{ if .Date }}
<span class="page-metadata-item" aria-label="date">
{{ partial "icon.html" "calendar" }}
@@ -14,5 +14,5 @@
{{ partial "page-metadata/item/series.html" . }}
{{ partial "page-metadata/item/categories.html" . }}
{{ partial "page-metadata/item/tags.html" . }}
</section>
</div>
{{ end }}

View File

@@ -1,4 +1,4 @@
<section class="share-buttons">
<div class="share-buttons">
{{ if .Site.Params.shareButtons.twitter }}
<a class="twitter-share"
target="_blank"
@@ -66,4 +66,4 @@
{{- partial "icon.html" "printer" -}}
</a>
{{ end }}
</section>
</div>

View File

@@ -1,13 +1,13 @@
<header class="top">
<div class="top-brand">
<header class="body-module body-module--marginless top">
<div class="brand">
<a href="{{ .Site.Home.Permalink | absLangURL }}">
{{ .Site.Title | markdownify }}
</a>
</div>
<nav class="top-navbar" aria-label="{{ i18n "aria_navbar" }}">
<nav class="navbar" aria-label="{{ i18n "aria_navbar" }}">
{{ with .Site.Home }}
<a class="top-navbar-item{{ if $.IsHome }} top-navbar-item--active{{ end }}" href="{{ .Permalink | absLangURL }}">{{ .Title | markdownify }}</a>
<a class="navbar-item{{ if $.IsHome }} active{{ end }}" href="{{ .Permalink | absLangURL }}">{{ .Title | markdownify }}</a>
{{ end }}
{{ range .Site.Menus.main }}
@@ -16,7 +16,7 @@
{{ if or ($.HasMenuCurrent .Menu .) (eq .Page $) }}
{{ $isActive = true }}
{{ end }}
<a class="top-navbar-item{{ if $isActive }} top-navbar-item--active{{ end }}"
<a class="navbar-item{{ if $isActive }} active{{ end }}"
{{ if strings.HasPrefix .URL "http" }}target="_blank" rel="noopener"{{ end }}
href="{{ .URL }}">{{ .Name }}</a>
{{ end }}

View File

@@ -11,7 +11,9 @@
<div class="page-list">
{{ with .Paginator.Pages }}
{{ range . }}
{{ .Render "summary" }}
<article class="page">
{{ .Render "summary" }}
</article>
{{ end }}
{{ else }}
<div>

View File

@@ -1,18 +1,16 @@
<article class="summary-card">
<h2 class="summary-card-title">
<a href="{{ .Permalink }}">{{ .Title | markdownify }}</a>
{{ if .Draft }}{{ partial "icon.html" "write" }}{{ end }}
</h2>
<h2 class="page-title">
<a href="{{ .Permalink }}">{{ .Title | markdownify }}</a>
{{ if .Draft }}{{ partial "icon.html" "write" }}{{ end }}
</h2>
{{ partial "page-metadata/author.html" . }}
{{ partial "page-metadata/author.html" . }}
{{ with .Summary }}
<div class="summary-card-description">
{{ . }}
</div>
{{ end }}
<div class="summary-card-readmore">
<a href="{{ .Permalink }}">{{ i18n "see_posts" }} &rarr;</a>
{{ with .Summary }}
<div class="page-description">
{{ . }}
</div>
</article>
{{ end }}
<div class="readmore">
<a href="{{ .Permalink }}">{{ i18n "read_more" }} &rarr;</a>
</div>

View File

@@ -8,29 +8,29 @@
{{ partial "top.html" . }}
<div class="main-container">
{{ if not .IsHome }}
{{ partial "breadcrumb.html" . }}
{{ end }}
{{ if not .IsHome }}
{{ partial "breadcrumb.html" . }}
{{ end }}
<main id="main-content">
{{ block "main" . }}
THIS TEXT SHOULD NOT SHOW. YUZSIQGHE (that string is so I can grep for it)
{{ block "pre-body" . }}{{ end }}
<main id="main-content">
{{ block "main" . }}
THIS TEXT SHOULD NOT SHOW. YUZSIQGHE (that string is so I can grep for it)
{{ end }}
</main>
{{ if or .Site.Copyright .Site.Params.footer }}
<footer class="body-module body-module--wide">
{{ with .Site.Copyright }}
{{ . | safeHTML }}
{{ end }}
</main>
{{ if or .Site.Copyright .Site.Params.footer }}
<footer class="site-footer">
{{ with .Site.Copyright }}
{{ . | safeHTML }}
{{ end }}
{{ with .Site.Params.footer }}
{{ . | $.RenderString (dict "display" "block") }}
{{ end }}
</footer>
{{ end }}
</div>
{{ with .Site.Params.footer }}
{{ . | $.RenderString (dict "display" "block") }}
{{ end }}
</footer>
{{ end }}
{{ block "post-body" . }}
{{/* currently this is only used for related posts */}}

View File

@@ -1,13 +1,13 @@
{{ define "main" }}
{{ with .Content }}
<article class="homepage-content">
<article class="body-module body-module--wide">
{{ . }}
</article>
<hr class="body-module body-module--wide">
{{ end }}
{{ if .Site.Params.homepageLatestPosts }}
<hr>
<section class="homepage-latest-posts">
<div class="body-module body-module--wide">
<h1>
{{ i18n "latest_posts" }}
{{ partial "rss-link.html" . }}
@@ -16,6 +16,6 @@
{{ partial "page-list.html" (.Paginate .Site.RegularPages).Pages }}
{{ partial "pagination.html" . }}
</section>
</div>
{{ end }}
{{ end }}

View File

@@ -1,5 +1,5 @@
{{ define "main" }}
<article>
<article class="body-module body-module--wide">
<div class="page-title">
<h1>
{{ .Title | markdownify }}
@@ -11,28 +11,28 @@
{{ partial "series-box.html" . }}
{{ if .Params.Toc }}
<section class="table-of-contents" aria-label="{{ i18n "aria_table_of_contents" }}">
<div class="table-of-contents" aria-label="{{ i18n "aria_table_of_contents" }}">
<details>
<summary>{{ i18n "table_of_contents" }}</summary>
{{ .TableOfContents }}
</details>
</section>
</div>
<div class="table-of-contents print">
{{ i18n "table_of_contents" }}
{{ .TableOfContents }}
</div>
{{ end }}
{{ partial "featured-media.html" . }}
{{ partial "feature-figure.html" . }}
<div class="post-content" data-pagefind-body>
<article class="post-content" data-pagefind-body>
{{ .Content }}
</div>
</article>
{{ partial "series-box.html" . }}
{{ if or .NextInSection .PrevInSection }}
<nav class="prevnext">
<div class="prevnext">
{{ with .NextInSection }}
<a class="prev" href="{{ .Permalink }}">
<div class="prev-caption">
@@ -58,7 +58,7 @@
{{ else }}
<div class="next"></div>
{{ end }}
</nav>
</div>
{{ end }}
{{ if .Site.Params.shareButtons }}
@@ -66,21 +66,21 @@
{{ end }}
{{ if .Params.comments }}
<section class="comments">
<div class="comments">
{{ partial "comments.html" . }}
</section>
</div>
{{ end }}
{{ end }}
{{ define "post-body" }}
{{ $related := .Site.RegularPages.Related . | first 10 }}
{{ with $related }}
<div class="related-posts">
<hr>
<h1>{{ i18n "related_posts" }}</h1>
{{ partial "page-list.html" . }}
</div>
{{ end }}
</article>
{{ end }}
{{ define "post-body" }}
{{ $related := .Site.RegularPages.Related . | first 10 }}
{{ with $related }}
<div class="related-posts">
<hr>
<h1>{{ i18n "related_posts" }}</h1>
{{ partial "page-list.html" . }}
</div>
{{ end }}
{{ end }}

View File

@@ -9,15 +9,17 @@
{{ . }}
{{ end }}
{{ with .Sections }}
<div class="sections">
{{ range . }}
{{ .Render "summary" }}
{{ end }}
</div>
{{ end }}
<div class="list-page-container">
{{ with .Sections }}
<div class="sections">
{{ range . }}
{{ .Render "summary" }}
{{ end }}
</div>
{{ end }}
{{ partial "page-list.html" .Paginator.Pages }}
{{ partial "page-list.html" .Paginator.Pages }}
</div>
{{ partial "pagination.html" . }}
{{ end }}

View File

@@ -1,20 +1,14 @@
<a class="section-anchor" href="{{ .Permalink }}">
<div class="section">
<div>
<h2 class="section-title">
{{ with .Params.icon }}{{ partial "icon.html" . }}{{ end }}
{{ .Title | markdownify }}
</h2>
<h2 class="section-title">
{{ with .Params.icon }}{{ partial "icon.html" . }}{{ end }}
{{ .Title | markdownify }}
</h2>
{{ with .Summary }}
<div class="section-description">
{{ . }}
</div>
{{ end }}
</div>
<div class="section-arrow">
{{ partial "icon.html" "arrow-right" }}
</div>
{{ with .Summary }}
<div class="section-description">
{{ . }}
</div>
{{ end }}
</div>
</a>

View File

@@ -1,19 +1,19 @@
{{ define "main" }}
<div class="page-title">
<h1>
{{ partial "icon.html" "files" }}
{{ .Title | markdownify }}
</h1>
</div>
<h1>
{{ partial "icon.html" "files" }}
{{ .Title | markdownify }}
</h1>
{{ with .Content }}
{{ . }}
{{ end }}
<div class="page-list page-list--series">
<div class="page-list series">
{{ with .Paginator.Pages }}
{{ range . }}
{{ .Render "summary" }}
<div class="page series">
{{ .Render "summary" }}
</div>
{{ end }}
{{ else }}
<div>

View File

@@ -1,21 +1,21 @@
<article class="summary-card">
<h2 class="summary-card-title">
{{ with .Parent.Params.icon }}{{ partial "icon.html" . }}{{ end }}
<a href="{{ .Permalink }}">{{ .Title | markdownify }}</a>
{{ if .Draft }}{{ partial "icon.html" "write" }}{{ end }}
</h2>
<h2 class="page-title">
{{ with .Parent.Params.icon }}{{ partial "icon.html" . }}{{ end }}
<a href="{{ .Permalink }}">{{ .Title | markdownify }}</a>
{{ if .Draft }}{{ partial "icon.html" "write" }}{{ end }}
</h2>
{{ partial "page-metadata/series.html" . }}
{{ partial "page-metadata/series.html" . }}
{{ with .Summary }}
<div class="summary-card-description">
{{ . }}
</div>
{{ end }}
<div class="page-list page-list--series-inner">
{{ range .Data.Pages.Reverse }}
{{ .Render "summary" }}
{{ end }}
{{ with .Summary }}
<div class="page-description">
{{ . }}
</div>
</article>
{{ end }}
<div class="page-list series-inner">
{{ range .Data.Pages.Reverse }}
<article class="page">
{{ .Render "summary" }}
</article>
{{ end }}
</div>

View File

@@ -1,21 +1,19 @@
<article class="summary-card">
<h2 class="summary-card-title">
{{ with .Parent.Params.icon }}{{ partial "icon.html" . }}{{ end }}
<a href="{{ .Permalink }}">{{ .Title | markdownify }}</a>
{{ if .Draft }}{{ partial "icon.html" "write" }}{{ end }}
</h2>
<h2 class="page-title">
{{ with .Parent.Params.icon }}{{ partial "icon.html" . }}{{ end }}
<a href="{{ .Permalink }}">{{ .Title | markdownify }}</a>
{{ if .Draft }}{{ partial "icon.html" "write" }}{{ end }}
</h2>
{{ partial "page-metadata/post-short.html" . }}
{{ partial "page-metadata/post-short.html" . }}
{{ partial "featured-media.html" . }}
{{ partial "feature-figure.html" . }}
{{ with .Summary }}
<div class="summary-card-description">
{{ . }}
</div>
{{ end }}
<div class="summary-card-readmore">
<a href="{{ .Permalink }}">{{ i18n "read_more" }} &rarr;</a>
{{ with .Summary }}
<div class="page-description">
{{ . }}
</div>
</article>
{{ end }}
<div class="readmore">
<a href="{{ .Permalink }}">{{ i18n "read_more" }} &rarr;</a>
</div>