Swap prettier for djlint

This commit is contained in:
Jan Kremer 2026-02-26 07:35:56 +01:00
parent e2fd2a13e8
commit 212ca46616
No known key found for this signature in database
12 changed files with 150 additions and 178 deletions

View file

@ -1,11 +1,9 @@
<ul> <ul>
<li> <li>
<a <a href="https://creativecommons.org/publicdomain/zero/1.0/"
href="https://creativecommons.org/publicdomain/zero/1.0/"
target="_blank" target="_blank"
rel="noopener noreferrer" rel="noopener noreferrer"
aria-label="CC0: This work has been marked as dedicated to the public domain." aria-label="CC0: This work has been marked as dedicated to the public domain.">
>
{{ partial "cc.svg" . }} {{ partial "cc.svg" . }}
{{ partial "zero.svg" . }} {{ partial "zero.svg" . }}
</a> </a>

View file

@ -12,7 +12,7 @@
<title> <title>
{{ if .IsHome }} {{ if .IsHome }}
{{ site.Title }} {{ site.Title }}
{{ else }} {{ else }}
{{ printf "%s %s" .Title {{ printf "%s %s" .Title
site.Title site.Title
}} }}
@ -21,7 +21,7 @@
{{ partialCached "head/css.html" . }} {{ partialCached "head/css.html" . }}
{{ partialCached "head/js.html" . }} {{ partialCached "head/js.html" . }}
{{ with .OutputFormats.Get "rss" }} {{ with .OutputFormats.Get "rss" }}
{{ printf `<link rel=%q type=%q href=%q title=%q>` .Rel .MediaType.Type .Permalink site.Title | safeHTML }} {{ printf `<link rel=%q type=%q href=%q title=%q>` .Rel .MediaType.Type .Permalink site.Title | safeHTML }}
{{ end }}{{ with .OutputFormats.Get "atom" }} {{ end }}{{ with .OutputFormats.Get "atom" }}
{{ printf `<link rel=%q type=%q href=%q title=%q>` .Rel .MediaType.Type .Permalink site.Title | safeHTML }} {{ printf `<link rel=%q type=%q href=%q title=%q>` .Rel .MediaType.Type .Permalink site.Title | safeHTML }}
{{ end }} {{ end }}

View file

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

View file

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

View file

@ -1,4 +1,2 @@
<a href="/" class="title"> <a href="/" class="title">{{ partial "logo.svg" . }}{{ site.Title }}</a>
{{ partial "logo.svg" . }}{{ site.Title }}
</a>
{{ partial "menu.html" (dict "menuID" "main" "page" .) }} {{ partial "menu.html" (dict "menuID" "main" "page" .) }}

View file

@ -9,44 +9,39 @@
*/}} */}}
{{- $page := .page }} {{- $page := .page }}
{{- $menuID := .menuID }} {{- $menuID := .menuID }}
{{- with index site.Menus $menuID }} {{- with index site.Menus $menuID }}
<nav> <nav>
<ul> <ul>
{{- partial "inline/menu/walk.html" (dict "page" $page "menuEntries" .) }} {{- partial "inline/menu/walk.html" (dict "page" $page "menuEntries" .) }}
</ul> </ul>
</nav> </nav>
{{- end }} {{- end }}
{{- define "partials/inline/menu/walk.html" }} {{- define "partials/inline/menu/walk.html" }}
{{- $page := .page }} {{- $page := .page }}
{{- range .menuEntries }} {{- range .menuEntries }}
{{- $attrs := dict "href" .URL }} {{- $attrs := dict "href" .URL }}
{{- if $page.IsMenuCurrent .Menu . }} {{- if $page.IsMenuCurrent .Menu . }}
{{- $attrs = merge $attrs (dict "class" "active" "aria-current" "page") }} {{- $attrs = merge $attrs (dict "class" "active" "aria-current" "page") }}
{{- else if $page.HasMenuCurrent .Menu . }} {{- else if $page.HasMenuCurrent .Menu . }}
{{- $attrs = merge $attrs (dict "class" "ancestor" "aria-current" "true") }} {{- $attrs = merge $attrs (dict "class" "ancestor" "aria-current" "true") }}
{{- end }} {{- end }}
{{- $name := .Name }} {{- $name := .Name }}
{{- with .Identifier }} {{- with .Identifier }}
{{- with T . }} {{- with T . }}
{{- $name = . }} {{- $name = . }}
{{- end }} {{- end }}
{{- end }} {{- end }}
<li> <li>
<a <a {{- range $k, $v := $attrs }}
{{- range $k, $v := $attrs }}
{{- with $v }} {{- with $v }}
{{- printf " %s=%q" $k $v | safeHTMLAttr }} {{- printf " %s=%q" $k $v | safeHTMLAttr }}
{{- end }} {{- end }}
{{- end -}} {{- end -}}>{{ $name }}</a>
>{{ $name }}</a
>
{{- with .Children }} {{- with .Children }}
<ul> <ul>
{{- partial "inline/menu/walk.html" (dict "page" $page "menuEntries" .) }} {{- partial "inline/menu/walk.html" (dict "page" $page "menuEntries" .) }}
</ul> </ul>
{{- end }} {{- end }}
</li> </li>
{{- end }} {{- end }}
{{- end }} {{- end }}

View file

@ -6,17 +6,19 @@
{{- $page := .page }} {{- $page := .page }}
{{- $taxonomy := .taxonomy }} {{- $taxonomy := .taxonomy }}
{{- with $page.GetTerms {{- with $page.GetTerms
$taxonomy $taxonomy
}} }}
{{- $label := (index . 0).Parent.LinkTitle }} {{- $label := (index . 0).Parent.LinkTitle }}
<div class="tags"> <div class="tags">
<ul> <ul>
<li>Tags:</li> <li>Tags:</li>
<ul> <ul>
{{- range . }} {{- range . }}
<li><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></li> <li>
<a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>
</li>
{{- end }} {{- end }}
</ul> </ul>
</ul> </ul>
</div> </div>
{{- end }} {{- end }}

View file

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

View file

@ -1,9 +1,9 @@
{{ define "main" }} {{ define "main" }}
{{ .Content }} {{ .Content }}
{{ $pages := .Paginate (where {{ $pages := .Paginate (where
.Site.RegularPages "Type" "ne" "page") .Site.RegularPages "Type" "ne" "page")
}} }}
<div class="list"> <div class="list">
<ul> <ul>
{{ range $pages.Pages }} {{ range $pages.Pages }}
<li> <li>
@ -17,5 +17,5 @@
</li> </li>
{{ end }} {{ end }}
</ul> </ul>
</div> </div>
{{ end }} {{ end }}

View file

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

View file

@ -1,5 +1,5 @@
{{ define "main" }} {{ define "main" }}
<article> <article>
{{ $dateHuman := .Date | time.Format ":date_long" }} {{ $dateHuman := .Date | time.Format ":date_long" }}
{{ $dateMachine := .Date | time.Format "2006-01-02T15:04:05-07:00" }} {{ $dateMachine := .Date | time.Format "2006-01-02T15:04:05-07:00" }}
{{ $lastmodDateHuman := .Lastmod | time.Format ":date_long" }} {{ $lastmodDateHuman := .Lastmod | time.Format ":date_long" }}
@ -7,14 +7,14 @@
<div class="dates"> <div class="dates">
<p> <p>
Editiert: Editiert:
<time datetime="{{ $lastmodDateMachine }}" <time datetime="{{ $lastmodDateMachine }}">{{ $lastmodDateHuman }}</time>
>{{ $lastmodDateHuman }}</time </p>
> <p>
<time datetime="{{ $dateMachine }}">{{ $dateHuman }}</time>
</p> </p>
<p><time datetime="{{ $dateMachine }}">{{ $dateHuman }}</time></p>
</div> </div>
<h1>{{ .Title }}</h1> <h1>{{ .Title }}</h1>
<p class="lead">{{ .Description }}</p> <p class="lead">{{ .Description }}</p>
{{ .Content }} {{ .Content }}
</article> </article>
{{ end }} {{ end }}

View file

@ -1,26 +1,10 @@
{ pkgs, ... }:
{ {
programs = { programs = {
nixfmt.enable = true; nixfmt.enable = true;
gofmt.enable = true;
taplo.enable = true; taplo.enable = true;
prettier = { djlint.enable = true;
enable = true;
settings = {
plugins = [
"${pkgs.prettier-plugin-go-template}/lib/node_modules/prettier-plugin-go-template/lib/index.js"
];
overrides = [
{
files = [ "*.html" ];
options.parser = "go-template";
}
];
};
};
}; };
settings.global.excludes = [ settings.global.excludes = [
"archetypes/**"
"public/**" "public/**"
"static/**" "static/**"
".envrc" ".envrc"