Change article metadata classes to IDs

This commit is contained in:
Will Faught
2023-03-04 15:28:39 -08:00
parent 15f1a617ab
commit 0e25a00fe3
9 changed files with 80 additions and 71 deletions

View File

@@ -11,5 +11,5 @@
{{ $content := cond ($fullpages | not) ($page.Content | replaceRE `(<h[1-6] id="([^"]+)".+)(</h[1-6]+>)` (printf `${1}<a aria-label="%v" class="paige-header-link" href="#${2}">#</a>${3}` (i18n "paige_aria_section_link")) | safeHTML) $page.Content }}
{{ with $content }}
<div class="mw-100 overflow-x-auto paige-content">{{ . }}</div>
<div class="mw-100 overflow-x-auto {{ if $fullpages }} paige-content {{ end }}" {{ if not $fullpages }} id="paige-content" {{ end }}>{{ . }}</div>
{{ end }}

View File

@@ -10,10 +10,12 @@
{{ $authors := partial "paige/authors.html" $page }}
{{ $categories := $page.Params.categories | default slice | uniq }}
{{ $class := $fullpages }}
{{ $commiturl := "" }}
{{ $date := cond (eq ($page.Param "paige.date.source" | default "published") "published") $page.PublishDate $page.Lastmod }}
{{ $dateformat := $page.Param "paige.date.format" | default ":date_long" }}
{{ $description := $page.Description | markdownify }}
{{ $id := not $fullpages }}
{{ $nogap := "mb-0" }}
{{ $readingtime := $page.ReadingTime }}
{{ $tags := $page.Params.tags | default slice | uniq }}
@@ -27,15 +29,15 @@
<div class="paige-metadata w-100">
{{ with $title }}
<h1 class="display-5 fw-bold paige-title text-center">{{ with $titlelink }}<a href="{{ . }}">{{ . }}</a>{{ else }}{{ . }}{{ end }}{{ if $fullpages }}<a aria-label="{{ i18n `paige_aria_page_link` }}" class="paige-header-link" href="{{ $titlepage }}">#</a>{{ end }}</h1>
<h1 class="display-5 fw-bold {{ if $class }} paige-title {{ end }} text-center" {{ if $id }} id="paige-title" {{ end }}>{{ with $titlelink }}<a href="{{ . }}">{{ . }}</a>{{ else }}{{ . }}{{ end }}{{ if $fullpages }}<a aria-label="{{ i18n `paige_aria_page_link` }}" class="paige-header-link" href="{{ $titlepage }}">#</a>{{ end }}</h1>
{{ end }}
{{ with $description }}
<p class="lead paige-description text-center">{{ . }}</p>
<p class="lead {{ if $class }} paige-description {{ end }} text-center" {{ if $id }} id="paige-description" {{ end }}>{{ . }}</p>
{{ end }}
{{ if or $categories $tags }}
<p class="paige-terms text-center">
<p class="{{ if $class }} paige-terms {{ end }} text-center" {{ if $id }} id="paige-terms" {{ end }}>
{{ $terms := slice }}
{{ range $categories }}
@@ -55,11 +57,11 @@
{{ if or $authors $date $readingtime }}
<div class="mb-3">
{{ with $authors }}
<p class="mb-0 paige-authors text-center text-secondary">{{ . }}</p>
<p class="mb-0 {{ if $class }} paige-authors {{ end }} text-center text-secondary" {{ if $id }} id="paige-authors" {{ end }}>{{ . }}</p>
{{ end }}
{{ with $date }}
<p class="mb-0 paige-date text-center text-secondary">
<p class="mb-0 {{ if $class }} paige-date {{ end }} text-center text-secondary" {{ if $id }} id="paige-date" {{ end }}>
{{ with $commiturl }}
<a class="link-secondary text-decoration-none" href="{{ . }}">
{{ end }}
@@ -73,7 +75,7 @@
{{ end }}
{{ with $readingtime }}
<p class="mb-0 paige-reading-time text-center text-secondary">{{ . }} {{ i18n "paige_minutes" . }}</p>
<p class="mb-0 {{ if $class }} paige-reading-time {{ end }} text-center text-secondary" {{ if $id }} id="paige-reading-time" {{ end }}>{{ . }} {{ i18n "paige_minutes" . }}</p>
{{ end }}
</div>
{{ end }}

View File

@@ -9,7 +9,7 @@
{{ end }}
{{ if and $page.Content (not $fullpages) (ne $page.TableOfContents `<nav id="TableOfContents"></nav>`) }}
<div class="paige-toc">
<div id="paige-toc">
<div class="border mb-3 pe-3 ps-3 pt-3 rounded">
{{ $page.TableOfContents }}
</div>