From 212ca4661626cf7be7208ed614110f7264709faf Mon Sep 17 00:00:00 2001 From: Jan Kremer Date: Thu, 26 Feb 2026 07:35:56 +0100 Subject: [PATCH] Swap prettier for djlint --- layouts/_partials/footer.html | 48 ++++++++++++------------ layouts/_partials/head.html | 12 +++--- layouts/_partials/head/css.html | 26 ++++++------- layouts/_partials/head/js.html | 30 +++++++-------- layouts/_partials/header.html | 4 +- layouts/_partials/menu.html | 65 +++++++++++++++------------------ layouts/_partials/terms.html | 22 ++++++----- layouts/baseof.html | 29 ++++++++------- layouts/home.html | 30 +++++++-------- layouts/list.html | 26 ++++++------- layouts/single.html | 18 ++++----- treefmt.nix | 18 +-------- 12 files changed, 150 insertions(+), 178 deletions(-) diff --git a/layouts/_partials/footer.html b/layouts/_partials/footer.html index c826ef0..f1bce7b 100644 --- a/layouts/_partials/footer.html +++ b/layouts/_partials/footer.html @@ -1,27 +1,25 @@ diff --git a/layouts/_partials/head.html b/layouts/_partials/head.html index 7ea7a54..f58d3f2 100644 --- a/layouts/_partials/head.html +++ b/layouts/_partials/head.html @@ -10,18 +10,18 @@ - {{ if .IsHome }} + {{ if .IsHome }} {{ site.Title }} - {{ else }} +{{ else }} {{ printf "%s – %s" .Title - site.Title + site.Title }} - {{ end }} + {{ end }} {{ partialCached "head/css.html" . }} {{ partialCached "head/js.html" . }} {{ with .OutputFormats.Get "rss" }} - {{ printf `` .Rel .MediaType.Type .Permalink site.Title | safeHTML }} +{{ printf `` .Rel .MediaType.Type .Permalink site.Title | safeHTML }} {{ end }}{{ with .OutputFormats.Get "atom" }} - {{ printf `` .Rel .MediaType.Type .Permalink site.Title | safeHTML }} +{{ printf `` .Rel .MediaType.Type .Permalink site.Title | safeHTML }} {{ end }} diff --git a/layouts/_partials/head/css.html b/layouts/_partials/head/css.html index 4c1c0a1..2b0820f 100644 --- a/layouts/_partials/head/css.html +++ b/layouts/_partials/head/css.html @@ -1,16 +1,14 @@ {{- with resources.Get "css/main.css" }} - {{- if eq hugo.Environment - "development" - }} - - {{- else }} - {{- with . | minify | fingerprint }} - - {{- end }} - {{- end }} +{{- if eq hugo.Environment +"development" +}} + +{{- else }} +{{- with . | minify | fingerprint }} + +{{- end }} +{{- end }} {{- end }} diff --git a/layouts/_partials/head/js.html b/layouts/_partials/head/js.html index cf3c3c1..925267e 100644 --- a/layouts/_partials/head/js.html +++ b/layouts/_partials/head/js.html @@ -1,18 +1,16 @@ {{- with resources.Get "js/main.js" }} - {{- if eq hugo.Environment "development" }} - {{- with . | js.Build }} - - {{- end }} - {{- else }} - {{- $opts := dict "minify" true }} - {{- with . | js.Build - $opts | fingerprint - }} - - {{- end }} - {{- end }} +{{- if eq hugo.Environment "development" }} +{{- with . | js.Build }} + +{{- end }} +{{- else }} +{{- $opts := dict "minify" true }} +{{- with . | js.Build +$opts | fingerprint +}} + +{{- end }} +{{- end }} {{- end }} diff --git a/layouts/_partials/header.html b/layouts/_partials/header.html index d7365a2..e3dfeea 100644 --- a/layouts/_partials/header.html +++ b/layouts/_partials/header.html @@ -1,4 +1,2 @@ - - {{ partial "logo.svg" . }}{{ site.Title }} - +{{ partial "logo.svg" . }}{{ site.Title }} {{ partial "menu.html" (dict "menuID" "main" "page" .) }} diff --git a/layouts/_partials/menu.html b/layouts/_partials/menu.html index c23f626..da71505 100644 --- a/layouts/_partials/menu.html +++ b/layouts/_partials/menu.html @@ -9,44 +9,39 @@ */}} {{- $page := .page }} {{- $menuID := .menuID }} - {{- with index site.Menus $menuID }} - {{- end }} - {{- define "partials/inline/menu/walk.html" }} - {{- $page := .page }} - {{- range .menuEntries }} - {{- $attrs := dict "href" .URL }} - {{- if $page.IsMenuCurrent .Menu . }} - {{- $attrs = merge $attrs (dict "class" "active" "aria-current" "page") }} - {{- else if $page.HasMenuCurrent .Menu . }} - {{- $attrs = merge $attrs (dict "class" "ancestor" "aria-current" "true") }} - {{- end }} - {{- $name := .Name }} - {{- with .Identifier }} - {{- with T . }} - {{- $name = . }} - {{- end }} - {{- end }} -
  • - {{ $name }} - {{- with .Children }} - - {{- end }} -
  • - {{- end }} +{{- $page := .page }} +{{- range .menuEntries }} +{{- $attrs := dict "href" .URL }} +{{- if $page.IsMenuCurrent .Menu . }} +{{- $attrs = merge $attrs (dict "class" "active" "aria-current" "page") }} +{{- else if $page.HasMenuCurrent .Menu . }} +{{- $attrs = merge $attrs (dict "class" "ancestor" "aria-current" "true") }} +{{- end }} +{{- $name := .Name }} +{{- with .Identifier }} +{{- with T . }} +{{- $name = . }} +{{- end }} +{{- end }} +
  • + {{ $name }} + {{- with .Children }} + + {{- end }} +
  • +{{- end }} {{- end }} diff --git a/layouts/_partials/terms.html b/layouts/_partials/terms.html index bc05274..b10860d 100644 --- a/layouts/_partials/terms.html +++ b/layouts/_partials/terms.html @@ -6,17 +6,19 @@ {{- $page := .page }} {{- $taxonomy := .taxonomy }} {{- with $page.GetTerms - $taxonomy +$taxonomy }} - {{- $label := (index . 0).Parent.LinkTitle }} -
    +{{- $label := (index . 0).Parent.LinkTitle }} +
    -
    +
    {{- end }} diff --git a/layouts/baseof.html b/layouts/baseof.html index fc6f0d8..a949b43 100644 --- a/layouts/baseof.html +++ b/layouts/baseof.html @@ -1,15 +1,16 @@ - - - - {{ partial "head.html" . }} - - - -
    {{ partial "header.html" . }}
    -
    {{ block "main" . }}{{ end }}
    - - + + + {{ partial "head.html" . }} + +
    + {{ partial "header.html" . }} +
    +
    + {{ block "main" . }}{{ end }} +
    + + diff --git a/layouts/home.html b/layouts/home.html index 0b1ff1e..50eeecd 100644 --- a/layouts/home.html +++ b/layouts/home.html @@ -1,21 +1,21 @@ {{ define "main" }} - {{ .Content }} - {{ $pages := .Paginate (where - .Site.RegularPages "Type" "ne" "page") - }} -
    +{{ .Content }} +{{ $pages := .Paginate (where +.Site.RegularPages "Type" "ne" "page") +}} + +
    {{ end }} diff --git a/layouts/list.html b/layouts/list.html index aadda4f..c62e475 100644 --- a/layouts/list.html +++ b/layouts/list.html @@ -1,20 +1,18 @@ {{ define "main" }} - {{ .Content }} -
    +{{ .Content }} + +
    {{ end }} diff --git a/layouts/single.html b/layouts/single.html index 4bf362a..9ce735a 100644 --- a/layouts/single.html +++ b/layouts/single.html @@ -1,20 +1,20 @@ {{ define "main" }} -
    +
    {{ $dateHuman := .Date | time.Format ":date_long" }} {{ $dateMachine := .Date | time.Format "2006-01-02T15:04:05-07:00" }} {{ $lastmodDateHuman := .Lastmod | time.Format ":date_long" }} {{ $lastmodDateMachine := .Lastmod | time.Format "2006-01-02T15:04:05-07:00" }}
    -

    - Editiert: - -

    -

    +

    + Editiert: + +

    +

    + +

    {{ .Title }}

    {{ .Description }}

    {{ .Content }} -
    +
    {{ end }} diff --git a/treefmt.nix b/treefmt.nix index 558a8e8..7205383 100644 --- a/treefmt.nix +++ b/treefmt.nix @@ -1,26 +1,10 @@ -{ pkgs, ... }: { programs = { nixfmt.enable = true; - gofmt.enable = true; taplo.enable = true; - prettier = { - 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"; - } - ]; - }; - }; + djlint.enable = true; }; settings.global.excludes = [ - "archetypes/**" "public/**" "static/**" ".envrc"