initial template

This commit is contained in:
Drew
2025-04-25 23:30:12 -06:00
commit c70da2eaac
15 changed files with 384 additions and 0 deletions

View File

@ -0,0 +1,6 @@
<footer>
<h1 class="text-2xl font-bold">
<a href="/">{{ .Site.Title }}</a>
</h1>
<p class="text-lg">{{ .Site.Params.footer | markdownify }}</p>
</footer>

View File

@ -0,0 +1,25 @@
<!-- basic header partial in hugo with just home and about -->
<header class="flex flex-col mb-4">
<div class="flex justify-between items-center p-4">
<h1 class="text-2xl font-bold">
<a href="/">{{ .Site.Title }}</a>
</h1>
<nav class="font-iosevka">
<ul class="flex gap-4">
<li>
<a href="/">Home</a>
</li>
<li>
<a href="/about">About</a>
</li>
</ul>
</nav>
</div>
<div class="wompum-container wompum-container--wide-gap px-4 h-1">
<div class="wompum-grid"
data-text="{{ .Site.Title }}"
data-columns="7"
data-rows="1">
</div>
</div>
</header>

View File

@ -0,0 +1,19 @@
{{ $width := .width }}
{{ $height := default $width .height }}
{{ $class := .class }}
{{ $resource := .resource }}
{{ $alt := .alt }}
{{ with $resource }}
{{ $image := .Fit (printf "%dx%d webp" (int $width) (int $height)) }}
{{ $fallback := .Fit (printf "%dx%d" (int $width) (int $height)) }}
<picture class="{{ $class }} block">
<source srcset="{{ $image.RelPermalink }}" type="image/webp">
<img
src="{{ $fallback.RelPermalink }}"
alt="{{ $alt }}"
width="{{ $width }}"
height="{{ $height }}"
loading="lazy">
</picture>
{{ end }}

View File

@ -0,0 +1,40 @@
{{- $topics := .topics -}}
{{- $limit := default 3 .limit -}}
{{- $currentPath := .page.RelPermalink -}}
{{- $related := where (where site.RegularPages "Type" "articles") "RelPermalink" "!=" $currentPath -}}
{{- $matchingArticles := slice -}}
{{/* First try to find articles with matching topics */}}
{{- range $related -}}
{{- $matches := 0 -}}
{{- range .Params.topics -}}
{{- if in $topics . -}}
{{- $matches = add $matches 1 -}}
{{- end -}}
{{- end -}}
{{- if gt $matches 0 -}}
{{- $matchingArticles = $matchingArticles | append (dict "page" . "matches" $matches) -}}
{{- end -}}
{{- end -}}
{{/* If we found matching articles, sort by number of matching topics */}}
{{- $finalArticles := slice -}}
{{- if gt (len $matchingArticles) 0 -}}
{{- $finalArticles = first $limit (sort $matchingArticles "matches" "desc") -}}
{{- else -}}
{{/* Fallback to showing other articles sorted by date */}}
{{- $finalArticles = first $limit (sort $related "Date" "desc") -}}
{{- end -}}
{{- if gt (len $finalArticles) 0 -}}
<div class="related-articles flex flex-wrap gap-4">
<h2 class="title text-3xl font-bold">Related Articles</h2>
<div class="wompum-container wompum-container--no-gap">
<div class="wompum-grid" data-text="Related Articles" data-columns="8" data-rows="1"></div>
</div>
<ul class="flex flex-col gap-4 w-full">
{{ partial "article-list" (dict "Pages" $finalArticles) }}
</ul>
</div>
{{- end -}}

View File

@ -0,0 +1,10 @@
{{ $taxonomy := .taxonomy }}
{{ range $term, $pages := index .Site.Taxonomies $taxonomy }}
{{ $termPage := $.Site.GetPage (printf "/%s/%s" $taxonomy $term) }}
<a href="{{ $termPage.RelPermalink }}"
data-size="{{ len $pages }}"
class="tag"
data-count="{{ len $pages}}">
{{ $term }}
</a>
{{ end }}