flake: add treefmt, reorganize flake, format using treefmt

This commit is contained in:
Jan Kremer 2024-07-02 20:29:39 +02:00
parent 967b613d91
commit 12aa7125b5
No known key found for this signature in database
17 changed files with 187 additions and 123 deletions

View file

@ -1,21 +1,15 @@
<!DOCTYPE html>
<html lang="{{ or site.Language.LanguageCode site.Language.Lang }}"
dir="{{ or site.Language.LanguageDirection `ltr` }}">
<head>
{{ partial "head.html" . }}
</head>
<body>
<header>
{{ partial "header.html" . }}
</header>
<main>
{{ block "main" . }}{{ end }}
</main>
<footer>
{{ partial "footer.html" . }}
</footer>
</body>
<!doctype html>
<html
lang="{{ or site.Language.LanguageCode site.Language.Lang }}"
dir="{{ or site.Language.LanguageDirection `ltr` }}"
>
<head>
{{ partial "head.html" . }}
</head>
<body>
<header>{{ partial "header.html" . }}</header>
<main>{{ block "main" . }}{{ end }}</main>
<footer>{{ partial "footer.html" . }}</footer>
</body>
</html>

View file

@ -1,11 +1,9 @@
{{ define "main" }}
{{ .Content }}
{{ $pages := .Paginate (where .Site.RegularPages "Type" "ne" "page") }}
{{ range $pages.Pages }}
<a href="{{ .RelPermalink }}" style="display:block">
{{ define "main" }} {{ .Content }} {{ $pages := .Paginate (where
.Site.RegularPages "Type" "ne" "page") }} {{ range $pages.Pages }}
<a href="{{ .RelPermalink }}" style="display: block">
<div class="list">
{{ $dateMachine := .Date | time.Format "2006-01-02T15:04:05-07:00" }}
{{ $dateHuman := .Date | time.Format "2006-01-02" }}
{{ $dateMachine := .Date | time.Format "2006-01-02T15:04:05-07:00" }} {{
$dateHuman := .Date | time.Format "2006-01-02" }}
<time datetime="{{ $dateMachine }}">{{ $dateHuman }}</time>
<h2>{{ .Title }}</h2>
@ -13,5 +11,4 @@
<p class="lead">{{ .Description }}</p>
</div>
</a>
{{ end }}
{{ end }}
{{ end }} {{ end }}

View file

@ -1,10 +1,8 @@
{{ define "main" }}
{{ .Content }}
{{ range .Pages }}
<a href="{{ .RelPermalink }}" style="display:block">
{{ define "main" }} {{ .Content }} {{ range .Pages }}
<a href="{{ .RelPermalink }}" style="display: block">
<div class="list">
{{ $dateMachine := .Date | time.Format "2006-01-02T15:04:05-07:00" }}
{{ $dateHuman := .Date | time.Format "2006-01-02" }}
{{ $dateMachine := .Date | time.Format "2006-01-02T15:04:05-07:00" }} {{
$dateHuman := .Date | time.Format "2006-01-02" }}
<time datetime="{{ $dateMachine }}">{{ $dateHuman }}</time>
<h2>{{ .Title }}</h2>
@ -12,5 +10,4 @@
<p class="lead">{{ .Description }}</p>
</div>
</a>
{{ end }}
{{ end }}
{{ end }} {{ end }}

View file

@ -1,9 +1,9 @@
{{ define "main" }}
<article>
{{ $dateMachine := .Lastmod | time.Format "2006-01-02T15:04:05-07:00" }}
{{ $dateHuman := .Lastmod | time.Format "2006-01-02" }}
{{ $dateMachine := .Lastmod | time.Format "2006-01-02T15:04:05-07:00" }} {{
$dateHuman := .Lastmod | time.Format "2006-01-02" }}
<time datetime="{{ $dateMachine }}">{{ $dateHuman }}</time>
<br>
<br />
<h1>{{ .Title }}</h1>
@ -11,5 +11,4 @@
{{ .Content }}
</article>
{{ partial "terms.html" (dict "taxonomy" "tags" "page" .) }}
{{ end }}
{{ partial "terms.html" (dict "taxonomy" "tags" "page" .) }} {{ end }}

View file

@ -1,3 +1,7 @@
{{ if hugo.IsProduction }}
<script data-goatcounter="https://jankremer.goatcounter.com/count" async src="//gc.zgo.at/count.js"></script>
<script
data-goatcounter="https://jankremer.goatcounter.com/count"
async
src="//gc.zgo.at/count.js"
></script>
{{ end }}

View file

@ -1,9 +1,11 @@
{{- with resources.Get "css/main.css" }}
{{- if eq hugo.Environment "development" }}
<link rel="stylesheet" href="{{ .RelPermalink }}">
{{- else }}
{{- with . | minify | fingerprint }}
<link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous">
{{- end }}
{{- end }}
{{- end }}
{{- with resources.Get "css/main.css" }} {{- if eq hugo.Environment
"development" }}
<link rel="stylesheet" href="{{ .RelPermalink }}" />
{{- else }} {{- with . | minify | fingerprint }}
<link
rel="stylesheet"
href="{{ .RelPermalink }}"
integrity="{{ .Data.Integrity }}"
crossorigin="anonymous"
/>
{{- end }} {{- end }} {{- end }}

View file

@ -1,12 +1,11 @@
{{- with resources.Get "js/main.js" }}
{{- if eq hugo.Environment "development" }}
{{- with . | js.Build }}
<script src="{{ .RelPermalink }}"></script>
{{- end }}
{{- else }}
{{- $opts := dict "minify" true }}
{{- with . | js.Build $opts | fingerprint }}
<script src="{{ .RelPermalink }}" integrity="{{- .Data.Integrity }}" crossorigin="anonymous"></script>
{{- end }}
{{- end }}
{{- end }}
{{- with resources.Get "js/main.js" }} {{- if eq hugo.Environment "development"
}} {{- with . | js.Build }}
<script src="{{ .RelPermalink }}"></script>
{{- end }} {{- else }} {{- $opts := dict "minify" true }} {{- with . | js.Build
$opts | fingerprint }}
<script
src="{{ .RelPermalink }}"
integrity="{{- .Data.Integrity }}"
crossorigin="anonymous"
></script>
{{- end }} {{- end }} {{- end }}

View file

@ -1,17 +1,8 @@
{{- /*
For a given taxonomy, renders a list of terms assigned to the page.
@context {page} page The current page.
@context {string} taxonomy The taxonony.
@example: {{ partial "terms.html" (dict "taxonomy" "tags" "page" .) }}
*/}}
{{- $page := .page }}
{{- $taxonomy := .taxonomy }}
{{- with $page.GetTerms $taxonomy }}
{{- $label := (index . 0).Parent.LinkTitle }}
{{- /* For a given taxonomy, renders a list of terms assigned to the page.
@context {page} page The current page. @context {string} taxonomy The taxonony.
@example: {{ partial "terms.html" (dict "taxonomy" "tags" "page" .) }} */}} {{-
$page := .page }} {{- $taxonomy := .taxonomy }} {{- with $page.GetTerms
$taxonomy }} {{- $label := (index . 0).Parent.LinkTitle }}
<div class="tags">
<ul>
{{- range . }}