From 631547a75142326a7c71bdf123e1475217a5ad73 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Wed, 22 Apr 2026 12:42:56 +0200 Subject: chore: replace with extracted danix.xyz-hacker theme (danix2-hugo-theme) --- layouts/404.en.html | 142 ++++++++++++++++ layouts/404.html | 98 ----------- layouts/404.it.html | 142 ++++++++++++++++ layouts/_default/_markup/render-codeblock.html | 23 +++ layouts/_default/_markup/render-heading.html | 5 + layouts/_default/baseof.html | 130 +++++++++++++++ layouts/_default/list.html | 39 +++++ layouts/_default/single.html | 54 ++++++ layouts/_partials/article-single.html | 56 ------- layouts/_partials/featured-card.html | 23 --- layouts/_partials/footer.html | 14 -- layouts/_partials/head.html | 8 - layouts/_partials/head/css.html | 15 -- layouts/_partials/head/js.html | 15 -- layouts/_partials/header.html | 29 ---- layouts/_partials/hero.html | 41 ----- layouts/_partials/menu.html | 51 ------ layouts/_partials/photo-article.html | 32 ---- layouts/_partials/post-card.html | 30 ---- layouts/_partials/share-sidebar.html | 28 ---- layouts/_partials/static-page.html | 33 ---- layouts/_partials/terms.html | 23 --- layouts/_partials/timeline-item.html | 31 ---- layouts/articles/single.html | 50 ++++++ layouts/baseof.html | 23 --- layouts/home.html | 48 ------ layouts/index.html | 59 +++++++ layouts/index.json | 13 ++ layouts/is/list.html | 22 +++ layouts/page.html | 9 - layouts/partials/article-card.html | 92 +++++++++++ layouts/partials/article-header.html | 71 ++++++++ layouts/partials/article-list-item.html | 95 +++++++++++ layouts/partials/article-nav.html | 46 ++++++ layouts/partials/article-types/life.html | 3 + layouts/partials/article-types/link.html | 17 ++ layouts/partials/article-types/photo.html | 19 +++ layouts/partials/article-types/quote.html | 15 ++ layouts/partials/article-types/tech.html | 3 + layouts/partials/back-to-top.html | 23 +++ layouts/partials/breadcrumb-jsonld.html | 36 ++++ layouts/partials/breadcrumb.html | 16 ++ layouts/partials/footer.html | 89 ++++++++++ layouts/partials/form-components.html | 219 +++++++++++++++++++++++++ layouts/partials/hamburger-menu.html | 125 ++++++++++++++ layouts/partials/head-meta.html | 57 +++++++ layouts/partials/header.html | 94 +++++++++++ layouts/partials/search-modal.html | 87 ++++++++++ layouts/partials/sidebar.html | 54 ++++++ layouts/partials/social-share.html | 123 ++++++++++++++ layouts/partials/tag-cloud.html | 90 ++++++++++ layouts/partials/toast-container.html | 13 ++ layouts/repository/single.html | 77 +++++++++ layouts/robots.txt | 5 + layouts/section.html | 40 ----- layouts/shortcodes/actions.html | 26 ++- layouts/shortcodes/contact.html | 65 ++++++++ layouts/shortcodes/div-close.html | 2 - layouts/shortcodes/div.html | 4 - layouts/shortcodes/dropcap.html | 15 +- layouts/shortcodes/em.html | 2 +- layouts/shortcodes/figure.html | 27 --- layouts/shortcodes/gal-img.html | 16 -- layouts/shortcodes/gallery.html | 13 +- layouts/shortcodes/gravatar.html | 67 ++------ layouts/shortcodes/image.html | 23 +++ layouts/shortcodes/img.html | 84 ---------- layouts/shortcodes/quote.html | 32 ++-- layouts/shortcodes/strike.html | 2 +- layouts/shortcodes/svg.html | 5 - layouts/shortcodes/video.html | 72 ++++---- layouts/taxonomy.html | 7 - layouts/taxonomy/list.html | 49 ++++++ layouts/taxonomy/term.html | 46 ++++++ layouts/term.html | 7 - 75 files changed, 2430 insertions(+), 929 deletions(-) create mode 100644 layouts/404.en.html delete mode 100644 layouts/404.html create mode 100644 layouts/404.it.html create mode 100644 layouts/_default/_markup/render-codeblock.html create mode 100644 layouts/_default/_markup/render-heading.html create mode 100644 layouts/_default/baseof.html create mode 100644 layouts/_default/list.html create mode 100644 layouts/_default/single.html delete mode 100644 layouts/_partials/article-single.html delete mode 100644 layouts/_partials/featured-card.html delete mode 100644 layouts/_partials/footer.html delete mode 100644 layouts/_partials/head.html delete mode 100644 layouts/_partials/head/css.html delete mode 100644 layouts/_partials/head/js.html delete mode 100644 layouts/_partials/header.html delete mode 100644 layouts/_partials/hero.html delete mode 100644 layouts/_partials/menu.html delete mode 100644 layouts/_partials/photo-article.html delete mode 100644 layouts/_partials/post-card.html delete mode 100644 layouts/_partials/share-sidebar.html delete mode 100644 layouts/_partials/static-page.html delete mode 100644 layouts/_partials/terms.html delete mode 100644 layouts/_partials/timeline-item.html create mode 100644 layouts/articles/single.html delete mode 100644 layouts/baseof.html delete mode 100644 layouts/home.html create mode 100644 layouts/index.html create mode 100644 layouts/index.json create mode 100644 layouts/is/list.html delete mode 100644 layouts/page.html create mode 100644 layouts/partials/article-card.html create mode 100644 layouts/partials/article-header.html create mode 100644 layouts/partials/article-list-item.html create mode 100644 layouts/partials/article-nav.html create mode 100644 layouts/partials/article-types/life.html create mode 100644 layouts/partials/article-types/link.html create mode 100644 layouts/partials/article-types/photo.html create mode 100644 layouts/partials/article-types/quote.html create mode 100644 layouts/partials/article-types/tech.html create mode 100644 layouts/partials/back-to-top.html create mode 100644 layouts/partials/breadcrumb-jsonld.html create mode 100644 layouts/partials/breadcrumb.html create mode 100644 layouts/partials/footer.html create mode 100644 layouts/partials/form-components.html create mode 100644 layouts/partials/hamburger-menu.html create mode 100644 layouts/partials/head-meta.html create mode 100644 layouts/partials/header.html create mode 100644 layouts/partials/search-modal.html create mode 100644 layouts/partials/sidebar.html create mode 100644 layouts/partials/social-share.html create mode 100644 layouts/partials/tag-cloud.html create mode 100644 layouts/partials/toast-container.html create mode 100644 layouts/repository/single.html create mode 100644 layouts/robots.txt delete mode 100644 layouts/section.html create mode 100644 layouts/shortcodes/contact.html delete mode 100644 layouts/shortcodes/div-close.html delete mode 100644 layouts/shortcodes/div.html delete mode 100644 layouts/shortcodes/figure.html delete mode 100644 layouts/shortcodes/gal-img.html create mode 100644 layouts/shortcodes/image.html delete mode 100644 layouts/shortcodes/img.html delete mode 100644 layouts/shortcodes/svg.html delete mode 100644 layouts/taxonomy.html create mode 100644 layouts/taxonomy/list.html create mode 100644 layouts/taxonomy/term.html delete mode 100644 layouts/term.html (limited to 'layouts') diff --git a/layouts/404.en.html b/layouts/404.en.html new file mode 100644 index 0000000..2829a20 --- /dev/null +++ b/layouts/404.en.html @@ -0,0 +1,142 @@ +{{ define "main" }} + +
+
+
+ +

+ 404 +

+ + +

+ {{ i18n "notFound" }} +

+ +

+ {{ i18n "notFoundMessage" }} +

+ + +
+
+ + +
+
+ +
+
+ {{ i18n "noSearchResults" }} +
+
+ + +
+

{{ i18n "recentArticles" }}

+
+ {{ range first 5 (where .Site.RegularPages "Section" "articles") }} + + {{ end }} +
+
+ + +
+ {{ partial "tag-cloud.html" (dict "page" . "showCount" true "wrapInWidget" false "headingLevel" "h3") }} +
+ + + + + +
+ +
+ + +
+ +
+ + +
+

{{ i18n "easterEggTitle" }}

+ +
+ + + +
+ + +
+
+
+
+
+ +{{ end }} diff --git a/layouts/404.html b/layouts/404.html deleted file mode 100644 index 3295630..0000000 --- a/layouts/404.html +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - 404 โ€” {{ .Site.Title }} - - - - {{ partialCached "head/css.html" . }} - {{ partialCached "head/js.html" . }} - - {{ $notfound := resources.Get "css/components/404.css" | fingerprint }} - - - - - - - {{ partial "header.html" . }} - -
-
- -
-
-
"
-

The page you're looking for doesn't exist. But that's okay, nothing exists until you find it.

-

โ€” 404 Philosopher

-
- - - - -
- - -
-
-

Recent Articles

-
    - {{ range first 5 (.Site.RegularPages.ByDate.Reverse) }} -
  • - - {{ .Title }} - -
  • - {{ end }} -
-
- -
-
- - - -
-
-
$ curl https://danix.xyz/lost
-
404: Not Found
-
$ ls /articles
-
-
-
-
-
-
- - {{ partial "footer.html" . }} - - - - - {{ $notFoundJS := resources.Get "js/404.js" | fingerprint }} - - - diff --git a/layouts/404.it.html b/layouts/404.it.html new file mode 100644 index 0000000..d876371 --- /dev/null +++ b/layouts/404.it.html @@ -0,0 +1,142 @@ +{{ define "main" }} + +
+
+
+ +

+ 404 +

+ + +

+ {{ i18n "notFound" }} +

+ +

+ {{ i18n "notFoundMessage" }} +

+ + +
+
+ + +
+
+ +
+
+ {{ i18n "noSearchResults" }} +
+
+ + +
+

{{ i18n "recentArticles" }}

+
+ {{ range first 5 (where .Site.RegularPages "Section" "articles") }} + + {{ end }} +
+
+ + +
+ {{ partial "tag-cloud.html" (dict "page" . "showCount" true "wrapInWidget" false "headingLevel" "h3") }} +
+ + + + + +
+ +
+ + +
+ +
+ + +
+

{{ i18n "easterEggTitle" }}

+ +
+ + + +
+ + +
+
+
+
+
+ +{{ end }} diff --git a/layouts/_default/_markup/render-codeblock.html b/layouts/_default/_markup/render-codeblock.html new file mode 100644 index 0000000..6f3e357 --- /dev/null +++ b/layouts/_default/_markup/render-codeblock.html @@ -0,0 +1,23 @@ +{{- $lang := .Type -}} +{{- $hasLang := gt (len $lang) 0 -}} +{{- $highlightLang := $lang -}} +{{- if not $hasLang -}}{{- $highlightLang = "text" -}}{{- end -}} +{{- $opts := dict "lineNos" true "lineNumbersInTable" true -}} + +
+ {{- if $hasLang -}} +
+ {{ $lang }} +
+ + +
+
+ {{- end -}} +
+{{- highlight .Inner $highlightLang $opts -}} +
+
diff --git a/layouts/_default/_markup/render-heading.html b/layouts/_default/_markup/render-heading.html new file mode 100644 index 0000000..d0d5e05 --- /dev/null +++ b/layouts/_default/_markup/render-heading.html @@ -0,0 +1,5 @@ +{{- if eq .Level 1 -}} +

{{ .Text | safeHTML }}

+{{- else -}} + {{ .Text | safeHTML }} +{{- end -}} diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html new file mode 100644 index 0000000..482006e --- /dev/null +++ b/layouts/_default/baseof.html @@ -0,0 +1,130 @@ + + + + + + {{ partial "head-meta.html" . }} + {{ .Title }}{{ if ne .Title .Site.Title }} โ€” {{ .Site.Title }}{{ end }} + + + + + + + + + + + + {{ $css := resources.Get "css/main.min.css" }} + + + + {{ $chroma := resources.Get "css/chroma-custom.css" | minify }} + + + + + {{ if eq .Kind "page" }} +
+ {{ partial "back-to-top.html" . }} + {{ end }} + + + {{ i18n "skipToContent" }} + + + +
+ + + + + + + + + {{ partial "header.html" . }} + + +
+ {{ block "main" . }}{{ end }} +
+ + + {{ partial "footer.html" . }} + + + {{ partial "search-modal.html" . }} + + + + + + + + + + {{ $themeScript := resources.Get "js/theme-toggle.js" | minify }} + + + + {{ $menuScript := resources.Get "js/menu.js" | minify }} + + + + {{ $contactScript := resources.Get "js/contact-form.js" | minify }} + + + + {{ $notFoundScript := resources.Get "js/not-found-page.js" | minify }} + + + + {{ if eq .Kind "page" }} + {{ $progressScript := resources.Get "js/reading-progress.js" | minify }} + + {{ end }} + + + {{ if eq .Kind "page" }} + {{ $codeScript := resources.Get "js/code-copy.js" | minify }} + + {{ end }} + + + {{ with resources.Get "js/matrix-rain.js" }} + {{ $s := . | minify }} + + {{ end }} + + + {{ $searchScript := resources.Get "js/search.js" | minify }} + + + + {{ if eq .Kind "section" }} + {{ $lazyScript := resources.Get "js/article-lazy.js" | minify }} + + {{ end }} + + + {{ $tagCloudScript := resources.Get "js/tag-cloud-spiral.js" | minify }} + + + diff --git a/layouts/_default/list.html b/layouts/_default/list.html new file mode 100644 index 0000000..09c0cbb --- /dev/null +++ b/layouts/_default/list.html @@ -0,0 +1,39 @@ +{{ define "main" }} +
+

+ {{ .Title }} +

+ + {{ $pinned := where .Pages "Params.pinned" true }} + {{ $unpinned := where .Pages "Params.pinned" false }} + {{ if eq (len $unpinned) 0 }} + {{ $unpinned = where .Pages "Params.pinned" nil }} + {{ if eq (len $unpinned) 0 }} + {{ $unpinned = where .Pages "Params.pinned" "" }} + {{ end }} + {{ end }} + + {{ $allPages := ($pinned | append $unpinned) }} + + {{ if eq (len $allPages) 0 }} +
+ {{ i18n "noRelated" }} +
+ {{ else }} +
    + {{ range $i, $page := (sort $pinned "Date" "desc") }} + {{ $side := "left" }} + {{ if eq (mod $i 2) 0 }}{{ $side = "left" }}{{ else }}{{ $side = "right" }}{{ end }} + {{ partial "article-list-item.html" (dict "Page" $page "side" $side) }} + {{ end }} + {{ $offset := len $pinned }} + {{ range $i, $page := (sort $unpinned "Date" "desc") }} + {{ $idx := add $i $offset }} + {{ $side := "left" }} + {{ if eq (mod $idx 2) 0 }}{{ $side = "left" }}{{ else }}{{ $side = "right" }}{{ end }} + {{ partial "article-list-item.html" (dict "Page" $page "side" $side) }} + {{ end }} +
+ {{ end }} +
+{{ end }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html new file mode 100644 index 0000000..7a1a069 --- /dev/null +++ b/layouts/_default/single.html @@ -0,0 +1,54 @@ +{{ define "main" }} +
+
+ +
+ + {{ if eq .Section "articles" }} + {{ partial "article-nav.html" (dict "page" . "variant" "top") }} + {{ end }} + + + {{ partial "breadcrumb.html" . }} + + + {{ partial "article-header.html" . }} + + +
+ {{ .Content }} +
+ + + {{ if .Params.tags }} +
+

{{ i18n "tags" }}

+
+ {{ $lang := .Lang }} + {{ range .Params.tags }} + {{ $tagUrl := printf "/tags/%s/" (. | urlize) }} + {{ if eq $lang "it" }} + {{ $tagUrl = printf "/it/tags/%s/" (. | urlize) }} + {{ end }} + + {{ . }} + + {{ end }} +
+
+ {{ end }} + + + {{ if eq .Section "articles" }} + {{ partial "article-nav.html" (dict "page" . "variant" "bottom") }} + {{ end }} +
+ + + {{ partial "sidebar.html" . }} +
+
+{{ end }} diff --git a/layouts/_partials/article-single.html b/layouts/_partials/article-single.html deleted file mode 100644 index f030869..0000000 --- a/layouts/_partials/article-single.html +++ /dev/null @@ -1,56 +0,0 @@ -
- - {{ if .Params.image }} -
-
-
- -

{{ .Title }}

-
-
- {{ end }} - - - - - - {{ partial "share-sidebar.html" . }} - - -
- {{ .Content }} -
- - - {{ $section := .Site.GetPage .Section }} - {{ if $section }} - {{ $prevPage := .PrevInSection }} - {{ $nextPage := .NextInSection }} - {{ if or $prevPage $nextPage }} - - {{ end }} - {{ end }} -
diff --git a/layouts/_partials/featured-card.html b/layouts/_partials/featured-card.html deleted file mode 100644 index cf2618f..0000000 --- a/layouts/_partials/featured-card.html +++ /dev/null @@ -1,23 +0,0 @@ -{{ $page := .page }} - -
- {{ if $page.Params.image }} - - {{ end }} - - -
diff --git a/layouts/_partials/footer.html b/layouts/_partials/footer.html deleted file mode 100644 index a9df047..0000000 --- a/layouts/_partials/footer.html +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/layouts/_partials/head.html b/layouts/_partials/head.html deleted file mode 100644 index 1a8a727..0000000 --- a/layouts/_partials/head.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - -{{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ .Title }} | {{ .Site.Title }}{{ end }} - -{{ partialCached "head/css.html" . }} -{{ partialCached "head/js.html" . }} diff --git a/layouts/_partials/head/css.html b/layouts/_partials/head/css.html deleted file mode 100644 index 8897866..0000000 --- a/layouts/_partials/head/css.html +++ /dev/null @@ -1,15 +0,0 @@ -{{- with resources.Get "css/main.css" }} - {{- $opts := dict - "minify" (cond hugo.IsDevelopment false true) - "sourceMap" (cond hugo.IsDevelopment "linked" "none") - }} - {{- with . | css.Build $opts }} - {{- if hugo.IsDevelopment }} - - {{- else }} - {{- with . | fingerprint }} - - {{- end }} - {{- end }} - {{- end }} -{{- end }} diff --git a/layouts/_partials/head/js.html b/layouts/_partials/head/js.html deleted file mode 100644 index 0210efa..0000000 --- a/layouts/_partials/head/js.html +++ /dev/null @@ -1,15 +0,0 @@ -{{- with resources.Get "js/main.js" }} - {{- $opts := dict - "minify" (cond hugo.IsDevelopment false true) - "sourceMap" (cond hugo.IsDevelopment "linked" "none") - }} - {{- with . | js.Build $opts }} - {{- if hugo.IsDevelopment }} - - {{- else }} - {{- with . | fingerprint }} - - {{- end }} - {{- end }} - {{- end }} -{{- end }} diff --git a/layouts/_partials/header.html b/layouts/_partials/header.html deleted file mode 100644 index 1f8efb8..0000000 --- a/layouts/_partials/header.html +++ /dev/null @@ -1,29 +0,0 @@ - diff --git a/layouts/_partials/hero.html b/layouts/_partials/hero.html deleted file mode 100644 index 57d223d..0000000 --- a/layouts/_partials/hero.html +++ /dev/null @@ -1,41 +0,0 @@ -
- -
-
-
welcome to
-

{{ .Site.Params.author }}

-
-

{{ .Site.Params.description }}

- -
-
-
-
- - - - root@danix.xyz -
-
-
$ whoami
-
danilo
-
$ cat roles.txt
-
Security & Web Dev
-
WordPress Developer
-
Bash Enthusiast
-
$ uptime
-
up 4 years, still learning
-
$ _
-
-
-
-
- - -
diff --git a/layouts/_partials/menu.html b/layouts/_partials/menu.html deleted file mode 100644 index 14245b5..0000000 --- a/layouts/_partials/menu.html +++ /dev/null @@ -1,51 +0,0 @@ -{{- /* -Renders a menu for the given menu ID. - -@context {page} page The current page. -@context {string} menuID The menu ID. - -@example: {{ partial "menu.html" (dict "menuID" "main" "page" .) }} -*/}} - -{{- $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 }} -{{- end }} diff --git a/layouts/_partials/photo-article.html b/layouts/_partials/photo-article.html deleted file mode 100644 index 1040c9b..0000000 --- a/layouts/_partials/photo-article.html +++ /dev/null @@ -1,32 +0,0 @@ -
    - - {{ if .Params.image }} -
    -
    -
    -

    {{ .Title }}

    -
    -
    - {{ end }} - - - - - -
    -
    - {{ .Content }} -
    -
    - - - {{ $photoUtils := resources.Get "js/photo-utils.js" }} - {{ $lightbox := resources.Get "js/lightbox.js" | fingerprint }} - - -
    diff --git a/layouts/_partials/post-card.html b/layouts/_partials/post-card.html deleted file mode 100644 index f3a1362..0000000 --- a/layouts/_partials/post-card.html +++ /dev/null @@ -1,30 +0,0 @@ -{{ if eq .context "home" }} -
    -
    {{ .type }}
    -
    -

    {{ .title }}

    -

    {{ .description }}

    - -
    -
    -{{ else }} - {{ $featured := .featured }} -
    - {{ if .image }} - {{ .title }} - {{ else }} -
    - {{ end }} -
    -
    {{ .type }}
    -

    {{ .title }}

    -

    {{ .description }}

    -
    - {{ dateFormat "Jan 2, 2006" .date }} -
    -
    -
    -{{ end }} diff --git a/layouts/_partials/share-sidebar.html b/layouts/_partials/share-sidebar.html deleted file mode 100644 index 36b6d03..0000000 --- a/layouts/_partials/share-sidebar.html +++ /dev/null @@ -1,28 +0,0 @@ - diff --git a/layouts/_partials/static-page.html b/layouts/_partials/static-page.html deleted file mode 100644 index d557b2f..0000000 --- a/layouts/_partials/static-page.html +++ /dev/null @@ -1,33 +0,0 @@ -
    - -
    -
    -
    -

    {{ .Title }}

    -
    -
    - - -
    - {{ .Content }} -
    - - - {{ if eq .Section "is" }} - - {{ end }} -
    diff --git a/layouts/_partials/terms.html b/layouts/_partials/terms.html deleted file mode 100644 index 8a6ebec..0000000 --- a/layouts/_partials/terms.html +++ /dev/null @@ -1,23 +0,0 @@ -{{- /* -For a given taxonomy, renders a list of terms assigned to the page. - -@context {page} page The current page. -@context {string} taxonomy The taxonomy. - -@example: {{ partial "terms.html" (dict "taxonomy" "tags" "page" .) }} -*/}} - -{{- $page := .page }} -{{- $taxonomy := .taxonomy }} - -{{- with $page.GetTerms $taxonomy }} - {{- $label := (index . 0).Parent.LinkTitle }} -
    -
    {{ $label }}:
    - -
    -{{- end }} diff --git a/layouts/_partials/timeline-item.html b/layouts/_partials/timeline-item.html deleted file mode 100644 index fcb3f50..0000000 --- a/layouts/_partials/timeline-item.html +++ /dev/null @@ -1,31 +0,0 @@ -{{ $page := .page }} -{{ $index := .index }} -{{ $position := "left" }} -{{ if (eq (mod $index 2) 1) }} - {{ $position = "right" }} -{{ end }} - -
    -
    - -
    - {{ if $page.Params.image }} -
    - {{ $page.Title }} -
    - {{ end }} - -
    -
    - {{ $page.Params.type }} - -
    -

    - {{ $page.Title }} -

    - {{ with $page.Params.description }} -

    {{ . }}

    - {{ end }} -
    -
    -
    diff --git a/layouts/articles/single.html b/layouts/articles/single.html new file mode 100644 index 0000000..e646639 --- /dev/null +++ b/layouts/articles/single.html @@ -0,0 +1,50 @@ +{{ define "main" }} +{{ $articleType := .Params.type | default "life" }} +{{ $template := printf "article-types/%s.html" $articleType }} +
    +
    + +
    + + {{ partial "article-nav.html" (dict "page" . "variant" "top") }} + + + {{ partial "breadcrumb.html" . }} + + + {{ partial "article-header.html" . }} + + + {{ partial $template . }} + + + {{ if .Params.tags }} +
    +

    {{ i18n "tags" }}

    +
    + {{ $lang := .Lang }} + {{ range .Params.tags }} + {{ $tagUrl := printf "/tags/%s/" (. | urlize) }} + {{ if eq $lang "it" }} + {{ $tagUrl = printf "/it/tags/%s/" (. | urlize) }} + {{ end }} + + {{ . }} + + {{ end }} +
    +
    + {{ end }} + + + {{ partial "article-nav.html" (dict "page" . "variant" "bottom") }} +
    + + + {{ partial "sidebar.html" . }} +
    +
    +{{ end }} diff --git a/layouts/baseof.html b/layouts/baseof.html deleted file mode 100644 index cdbb1e3..0000000 --- a/layouts/baseof.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - {{ partial "head.html" . }} - - - - - {{ if and (not .IsHome) (ne .Kind "term") (ne .Kind "taxonomy") (ne .Kind "section") }} -
    - {{ end }} - {{ partial "header.html" . }} -
    {{ block "main" . }}{{ end }}
    - - - diff --git a/layouts/home.html b/layouts/home.html deleted file mode 100644 index 54d8087..0000000 --- a/layouts/home.html +++ /dev/null @@ -1,48 +0,0 @@ -{{ define "canvas-mode" }}hero{{ end }} - -{{ define "main" }} - {{ partial "hero.html" . }} - -
    - -
    -

    // latest posts

    -

    Recent Articles

    -
    - - {{ $articlesSection := .Site.GetPage "/articles" }} - {{ if $articlesSection }} - {{ $articles := $articlesSection.Pages }} - {{ $articles = sort $articles "Date" "desc" }} -
    - {{ range first 6 $articles }} - {{ $type := .Params.type }} - {{ if not $type }}{{ $type = "article" }}{{ end }} - - {{ $excerpt := .Params.excerpt }} - {{ if not $excerpt }} - {{ $excerpt = .Summary | plainify | truncate 150 }} - {{ end }} - - {{ $data := dict - "title" .Title - "type" $type - "description" $excerpt - "date" .Date - "url" .RelPermalink - "image" .Params.image - "featured" .Params.featured - "context" "home" - }} - {{ partial "post-card.html" $data }} - {{ end }} -
    - {{ end }} - -
    - View All Articles -
    - -
    -{{ end }} diff --git a/layouts/index.html b/layouts/index.html new file mode 100644 index 0000000..fd3cfa0 --- /dev/null +++ b/layouts/index.html @@ -0,0 +1,59 @@ +{{ define "main" }} +
    +
    + + {{ if .Params.image }} +
    + {{ .Site.Params.author }} +
    + {{ end }} + + + + +
    + {{ .Content }} +
    + + +
    + {{ $lang := .Lang }} + {{ $articlesUrl := "/articles/" }} + {{ $contactUrl := "/is/here/" }} + {{ if eq $lang "it" }} + {{ $articlesUrl = "/it/articles/" }} + {{ $contactUrl = "/it/is/here/" }} + {{ end }} + + + + {{ i18n "articles" }} + + + + + {{ i18n "contact" }} + +
    + + +
    + {{ partial "tag-cloud.html" (dict "page" . "showCount" true "wrapInWidget" false) }} +
    +
    +
    +{{ end }} diff --git a/layouts/index.json b/layouts/index.json new file mode 100644 index 0000000..e17e31e --- /dev/null +++ b/layouts/index.json @@ -0,0 +1,13 @@ +{{- $articles := where .Site.RegularPages "Section" "articles" -}} +{{- $articles = $articles.ByDate.Reverse -}} +[ + {{- range $index, $article := $articles -}} + { + "title": {{ $article.Title | jsonify }}, + "url": {{ $article.Permalink | jsonify }}, + "date": {{ $article.Date.Format "Jan 02, 2006" | jsonify }}, + "summary": {{ substr ($article.Summary | plainify) 0 160 | jsonify }} + } + {{- if ne (add $index 1) (len $articles) }},{{ end }} + {{- end }} +] diff --git a/layouts/is/list.html b/layouts/is/list.html new file mode 100644 index 0000000..128414f --- /dev/null +++ b/layouts/is/list.html @@ -0,0 +1,22 @@ +{{ define "main" }} +
    +
    + +
    + + {{ partial "breadcrumb.html" . }} + + + {{ partial "article-header.html" . }} + + +
    + {{ .Content }} +
    +
    + + + {{ partial "sidebar.html" . }} +
    +
    +{{ end }} diff --git a/layouts/page.html b/layouts/page.html deleted file mode 100644 index 44073b2..0000000 --- a/layouts/page.html +++ /dev/null @@ -1,9 +0,0 @@ -{{ define "main" }} - {{ if eq .Params.type "photo" }} - {{ partial "photo-article.html" . }} - {{ else if eq .Section "is" }} - {{ partial "static-page.html" . }} - {{ else }} - {{ partial "article-single.html" . }} - {{ end }} -{{ end }} diff --git a/layouts/partials/article-card.html b/layouts/partials/article-card.html new file mode 100644 index 0000000..d803464 --- /dev/null +++ b/layouts/partials/article-card.html @@ -0,0 +1,92 @@ +{{ $articleType := .Params.type | default "life" }} +{{ $typeConfig := .Site.Params.articleTypes }} +{{ $typeData := index $typeConfig $articleType }} +{{ $excerpt := .Description | default .Summary }} + +{{ $imageURL := "" }} +{{ $useDefaultThumbnail := false }} +{{ if .Params.image }} + {{ $resource := .Resources.GetMatch .Params.image }} + {{ if $resource }} + {{ $imageURL = $resource.RelPermalink }} + {{ else }} + {{ $imageURL = .Params.image }} + {{ end }} +{{ else }} + {{ $useDefaultThumbnail = true }} +{{ end }} + +
    + + {{ if or $imageURL $useDefaultThumbnail }} + + {{ if $useDefaultThumbnail }} + + + {{ .Title }} + + {{ else }} + {{ .Title }} + {{ end }} + + {{ if $typeData }} +
    + {{ i18n $articleType }} +
    + {{ end }} +
    + {{ end }} + + +
    + + {{ if .Params.pinned }} +
    + ๐Ÿ“Œ PINNED +
    + {{ end }} + + +

    + + {{ .Title }} + +

    + + +
    + +
    + + + {{ if $excerpt }} +

    + {{ $excerpt | plainify }} +

    + {{ end }} + + + + {{ i18n "readMore" }} + + +
    +
    diff --git a/layouts/partials/article-header.html b/layouts/partials/article-header.html new file mode 100644 index 0000000..94c78a5 --- /dev/null +++ b/layouts/partials/article-header.html @@ -0,0 +1,71 @@ +{{ $articleType := .Params.type | default "life" }} +{{ $typeConfig := .Site.Params.articleTypes }} +{{ $typeData := index $typeConfig $articleType }} +{{ $hasType := .Params.type }} + +
    + +
    + + {{ if and $typeData $hasType }} +
    + {{ end }} + + + {{ if and $typeData $hasType }} +
    + {{ end }} + +

    + {{ .Title }} +

    +
    + + +
    + + {{ if .PublishDate }} +
    + + +
    + {{ end }} + + + {{ if .Lastmod }} + {{ $lastmodDate := .Lastmod.Format "2006-01-02" }} + {{ $pubDate := .PublishDate.Format "2006-01-02" }} + {{ if ne $lastmodDate $pubDate }} +
    + + +
    + {{ end }} + {{ end }} + + + {{ if .Site.Params.readingTime }} +
    + + {{ .ReadingTime }} {{ i18n "min" }} {{ i18n "readingTime" }} +
    + {{ end }} + + + {{ if and $typeData $hasType }} + + {{ i18n $articleType }} + + {{ end }} +
    +
    diff --git a/layouts/partials/article-list-item.html b/layouts/partials/article-list-item.html new file mode 100644 index 0000000..44cbf32 --- /dev/null +++ b/layouts/partials/article-list-item.html @@ -0,0 +1,95 @@ +{{/* Handle both calling conventions: dict with .Page/.side or direct page */}} +{{ $page := . }} +{{ $side := "left" }} + +{{ if reflect.IsMap . }} + {{ $page = .Page }} + {{ $side = .side | default "left" }} +{{ end }} + +{{ $articleType := $page.Params.type | default "life" }} +{{ $typeConfig := $page.Site.Params.articleTypes }} +{{ $typeData := index $typeConfig $articleType }} +{{ $excerpt := $page.Description | default $page.Summary }} + +{{ $imageURL := "" }} +{{ $useDefaultThumbnail := false }} +{{ if $page.Params.image }} + {{ $resource := $page.Resources.GetMatch $page.Params.image }} + {{ if $resource }} + {{ $imageURL = $resource.RelPermalink }} + {{ else }} + {{ $imageURL = $page.Params.image }} + {{ end }} +{{ else }} + {{ $useDefaultThumbnail = true }} +{{ end }} + +
  • + {{/* Decorative connector line */}} + + + {{/* Node on spine */}} + + +
    + + {{/* Thumbnail */}} + + + {{/* Text body */}} +
    + + {{/* Pinned badge */}} + {{ if $page.Params.pinned }} +
    + ๐Ÿ“Œ {{ i18n "pinned" | default "PINNED" }} +
    + {{ end }} + + {{/* Type + date meta row */}} +
    + {{ i18n $articleType | upper }} + + +
    + + {{/* Title */}} +

    + {{ $page.Title }} +

    + + {{/* Excerpt */}} + {{ if $excerpt }} +

    {{ $excerpt | plainify }}

    + {{ end }} + + {{/* CTA */}} + + {{ i18n "readMore" }} + + + +
    +
    +
  • diff --git a/layouts/partials/article-nav.html b/layouts/partials/article-nav.html new file mode 100644 index 0000000..8a118b3 --- /dev/null +++ b/layouts/partials/article-nav.html @@ -0,0 +1,46 @@ +{{ $page := .page }} +{{ $variant := .variant | default "bottom" }} +{{ $prev := $page.PrevInSection }} +{{ $next := $page.NextInSection }} + +{{/* Shell prompt command varies by position */}} +{{ $cmd := "ls ../" }} +{{ if eq $variant "top" }} + {{ $cmd = "cd" }} +{{ end }} + + diff --git a/layouts/partials/article-types/life.html b/layouts/partials/article-types/life.html new file mode 100644 index 0000000..01cd8b8 --- /dev/null +++ b/layouts/partials/article-types/life.html @@ -0,0 +1,3 @@ +
    + {{ .Content }} +
    diff --git a/layouts/partials/article-types/link.html b/layouts/partials/article-types/link.html new file mode 100644 index 0000000..bbf7906 --- /dev/null +++ b/layouts/partials/article-types/link.html @@ -0,0 +1,17 @@ +
    + + {{ .Params.link_title | default (i18n "readMore") }} + + + + +
    + +
    + {{ .Content }} +
    diff --git a/layouts/partials/article-types/photo.html b/layouts/partials/article-types/photo.html new file mode 100644 index 0000000..743e02a --- /dev/null +++ b/layouts/partials/article-types/photo.html @@ -0,0 +1,19 @@ +{{ if .Params.featured_image }} +
    + {{ .Title }} + {{ if .Params.featured_image_caption }} +
    + {{ .Params.featured_image_caption }} +
    + {{ end }} +
    +{{ end }} + +
    + {{ .Content }} +
    diff --git a/layouts/partials/article-types/quote.html b/layouts/partials/article-types/quote.html new file mode 100644 index 0000000..f27d189 --- /dev/null +++ b/layouts/partials/article-types/quote.html @@ -0,0 +1,15 @@ +
    + "{{ .Params.quote_text }}" +
    + +{{ if .Params.quote_author }} +
    + โ€” {{ .Params.quote_author }} +
    +{{ end }} + +{{ if .Content }} +
    + {{ .Content }} +
    +{{ end }} diff --git a/layouts/partials/article-types/tech.html b/layouts/partials/article-types/tech.html new file mode 100644 index 0000000..01cd8b8 --- /dev/null +++ b/layouts/partials/article-types/tech.html @@ -0,0 +1,3 @@ +
    + {{ .Content }} +
    diff --git a/layouts/partials/back-to-top.html b/layouts/partials/back-to-top.html new file mode 100644 index 0000000..75095e3 --- /dev/null +++ b/layouts/partials/back-to-top.html @@ -0,0 +1,23 @@ +
    + +
    diff --git a/layouts/partials/breadcrumb-jsonld.html b/layouts/partials/breadcrumb-jsonld.html new file mode 100644 index 0000000..95b5e69 --- /dev/null +++ b/layouts/partials/breadcrumb-jsonld.html @@ -0,0 +1,36 @@ +{{- $homeURL := absURL "/" -}} +{{- $homeName := i18n "home" -}} +{{- if eq .Lang "it" -}} + {{- $homeURL = absURL "/it/" -}} +{{- end -}} + diff --git a/layouts/partials/breadcrumb.html b/layouts/partials/breadcrumb.html new file mode 100644 index 0000000..c15dfeb --- /dev/null +++ b/layouts/partials/breadcrumb.html @@ -0,0 +1,16 @@ +{{ $homeLink := "/" }} +{{ if eq .Lang "it" }} + {{ $homeLink = "/it/" }} +{{ end }} + + diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html new file mode 100644 index 0000000..1e50d6f --- /dev/null +++ b/layouts/partials/footer.html @@ -0,0 +1,89 @@ +{{- $quotes := .Site.Data.quotes.quotes -}} + + diff --git a/layouts/partials/form-components.html b/layouts/partials/form-components.html new file mode 100644 index 0000000..6c6416b --- /dev/null +++ b/layouts/partials/form-components.html @@ -0,0 +1,219 @@ +{{ define "form-components" }} + + + +
    +

    Form Components

    + + +
    + + +
    + + +
    + + +
    {{ i18n "form_invalid_email" }}
    +
    + + +
    + + +
    {{ i18n "form_password_help" | default "Must be at least 8 characters" }}
    +
    + + +
    + + +
    + + + +
    + + +
    + + + +
    + + +
    + + + +
    + +
    + + +
    +

    {{ i18n "form_select_interests" | default "Select your interests" }}

    + + +
    + + + +
    +

    {{ i18n "form_select_preference" | default "Select a preference" }}

    + + +
    + + + +
    +
    + + +
    +
    + + +
    +
    + + + +
    +
    + + +
    + +
    + + + +
    +

    Modal Examples

    + + + +
    + + + +
    +

    Notifications

    + + + + +
    + +
    + + + + + + + + + + + + + +{{ end }} diff --git a/layouts/partials/hamburger-menu.html b/layouts/partials/hamburger-menu.html new file mode 100644 index 0000000..5d8d8ed --- /dev/null +++ b/layouts/partials/hamburger-menu.html @@ -0,0 +1,125 @@ + +
    +
    + +
    + Menu + +
    + + + + + +
    + + + + +
    + +
    + + +
    + {{ i18n "noSearchResults" }} +
    +
    + + +
    +
    {{ i18n "language" }}
    +
    + {{ $currentLang := .Page.Language }} + {{ $currentPath := .RelPermalink }} + {{ range .Site.Languages }} + {{ $langCode := .Lang }} + {{ $langName := .LanguageName }} + {{ $current := eq $langCode $currentLang }} + + {{ $url := $currentPath }} + {{ if eq $langCode "en" }} + {{ if hasPrefix $currentPath "/it/" }} + {{ $url = strings.TrimPrefix "/it" $currentPath }} + {{ end }} + {{ else }} + {{ if not (hasPrefix $currentPath "/it/") }} + {{ $url = printf "/it%s" $currentPath }} + {{ end }} + {{ end }} + + {{ $langName }} + + {{ end }} +
    +
    + +
    +
    + + diff --git a/layouts/partials/head-meta.html b/layouts/partials/head-meta.html new file mode 100644 index 0000000..34a60e2 --- /dev/null +++ b/layouts/partials/head-meta.html @@ -0,0 +1,57 @@ +{{/* description: per-page excerpt wins over site-wide description */}} +{{ $description := .Site.Language.Params.siteDescription }} +{{ with .Params.excerpt }}{{ $description = . }}{{ end }} + +{{/* og:type: "article" only for single content pages that have a date */}} +{{ $ogType := "website" }} +{{ if and (eq .Kind "page") .Date }}{{ $ogType = "article" }}{{ end }} + +{{/* og:image: page image wins; fall back to lamp for homepage, dark thumbnail for articles */}} +{{ $defaultImage := "images/default_thumbnail_dark.png" }} +{{ if .IsHome }}{{ $defaultImage = "images/lampD.png" }}{{ end }} +{{ $ogImage := printf "%s%s" .Site.BaseURL $defaultImage }} +{{ with .Params.image }}{{ $ogImage = printf "%s%s" $.Site.BaseURL (strings.TrimLeft "/" .) }}{{ end }} + +{{/* author: page-level param wins; fall back to site param */}} +{{ $author := .Site.Params.author }} +{{ with .Params.author }}{{ $author = . }}{{ end }} + + + + + + + + + + + +{{ if eq $ogType "article" }} + + +{{ end }} + + + + + +{{ with .Site.Params.twitterHandle }} + +{{ end }} + +{{/* SEO: Self-referencing canonical */}} + + +{{/* SEO: hreflang alternates for all language variants */}} +{{ range .AllTranslations }} + +{{ end }} +{{/* x-default: EN version (served at root /) */}} +{{ range .AllTranslations }} + {{ if eq .Language.Lang "en" }} + + {{ end }} +{{ end }} + +{{/* Structured data: BreadcrumbList JSON-LD (single pages and named sections) */}} +{{ if or (eq .Kind "page") (eq .Kind "section") }}{{ partial "breadcrumb-jsonld.html" . }}{{ end }} diff --git a/layouts/partials/header.html b/layouts/partials/header.html new file mode 100644 index 0000000..914e645 --- /dev/null +++ b/layouts/partials/header.html @@ -0,0 +1,94 @@ +
    + + + + {{ partial "hamburger-menu.html" . }} +
    diff --git a/layouts/partials/search-modal.html b/layouts/partials/search-modal.html new file mode 100644 index 0000000..6b96b3a --- /dev/null +++ b/layouts/partials/search-modal.html @@ -0,0 +1,87 @@ + +
    + + + + + +
    diff --git a/layouts/partials/sidebar.html b/layouts/partials/sidebar.html new file mode 100644 index 0000000..a2225f1 --- /dev/null +++ b/layouts/partials/sidebar.html @@ -0,0 +1,54 @@ + diff --git a/layouts/partials/social-share.html b/layouts/partials/social-share.html new file mode 100644 index 0000000..9e9be43 --- /dev/null +++ b/layouts/partials/social-share.html @@ -0,0 +1,123 @@ +{{ $page := .page }} +{{ $mode := .mode | default "sidebar" }} +{{ $url := $page.Permalink | urlquery }} +{{ $title := $page.Title | urlquery }} + +{{ $gridClass := "share-grid gap-1" }} +{{ if eq $mode "inline" }} + {{ $gridClass = "flex flex-wrap justify-center gap-1" }} +{{ end }} + + diff --git a/layouts/partials/tag-cloud.html b/layouts/partials/tag-cloud.html new file mode 100644 index 0000000..b896e8d --- /dev/null +++ b/layouts/partials/tag-cloud.html @@ -0,0 +1,90 @@ +{{/* tag-cloud.html + Reusable tag cloud partial for homepage, sidebar, and 404 pages. + + Params (dict): + page Page required โ€” calling page context (provides .Site.Taxonomies.tags, .Lang) + showCount bool optional โ€” show post count per tag (default true) + heading string optional โ€” heading text override (default: i18n "tagCloud") + headingLevel string optional โ€” h2|h3|p for non-widget mode (default "h2") + wrapInWidget bool optional โ€” wrap in .sidebar-widget for sidebar placement (default false) + maxTags int optional โ€” max tags to show, 0 = all (default 0) +*/}} + +{{- $page := .page -}} +{{- $showCount := .showCount | default true -}} +{{- $heading := .heading | default (i18n "tagCloud") -}} +{{- $headingLevel := .headingLevel -}} +{{- $wrapInWidget := .wrapInWidget | default false -}} +{{- $maxTags := .maxTags | default 0 -}} + +{{- $tags := $page.Site.Taxonomies.tags -}} + +{{/* Early exit if no tags */}} +{{- if $tags -}} + +{{/* Compute max count for continuous scaling */}} +{{- $maxCount := 0 -}} +{{- range $tags -}} + {{- if gt .Count $maxCount -}}{{- $maxCount = .Count -}}{{- end -}} +{{- end -}} + +{{/* Ordered tag list (descending by count) */}} +{{- $orderedTags := $tags.ByCount -}} +{{- if gt $maxTags 0 -}} + {{- $orderedTags = first $maxTags $orderedTags -}} +{{- end -}} + +{{/* Render based on placement mode */}} +{{- if $wrapInWidget -}} + - diff --git a/layouts/shortcodes/div.html b/layouts/shortcodes/div.html deleted file mode 100644 index 0c0b755..0000000 --- a/layouts/shortcodes/div.html +++ /dev/null @@ -1,4 +0,0 @@ -{{ if .Get "class" }} -
    -{{ end }} - diff --git a/layouts/shortcodes/dropcap.html b/layouts/shortcodes/dropcap.html index 80cbefe..6114678 100644 --- a/layouts/shortcodes/dropcap.html +++ b/layouts/shortcodes/dropcap.html @@ -1,14 +1 @@ -{{/* - * The dropcap shortcode: - * - * Usage: - * - * {{< dropcap class="some class" >}} - * your paragraph that will have a drop cap here - * {{< /dropcap >}} - * - */}} - -

    - {{ .InnerDeindent }} -

    +{{ .Inner }} diff --git a/layouts/shortcodes/em.html b/layouts/shortcodes/em.html index 11f399a..a3a096c 100644 --- a/layouts/shortcodes/em.html +++ b/layouts/shortcodes/em.html @@ -1 +1 @@ -{{ .Inner | markdownify }} +{{ .Inner }} diff --git a/layouts/shortcodes/figure.html b/layouts/shortcodes/figure.html deleted file mode 100644 index 4cf2e7b..0000000 --- a/layouts/shortcodes/figure.html +++ /dev/null @@ -1,27 +0,0 @@ -{{/* - * This version of the figure shortcode needs to be closed and doesn't - * add an image itself, but relies on the img.html shortcode to provide - * a responsive image instead. - */}} - - {{- if .Get "link" -}} - - {{- end -}} - {{.InnerDeindent}} - {{- if .Get "link" }}{{ end -}} - {{- if or (or (.Get "title") (.Get "caption")) (.Get "attr") -}} -
    - {{ with (.Get "title") -}} -

    {{ . }}

    - {{- end -}} - {{- if or (.Get "caption") (.Get "attr") -}}

    - {{- .Get "caption" | markdownify -}} - {{- with .Get "attrlink" }} - - {{- end -}} - {{- .Get "attr" | markdownify -}} - {{- if .Get "attrlink" }}{{ end }}

    - {{- end }} -
    - {{- end }} - diff --git a/layouts/shortcodes/gal-img.html b/layouts/shortcodes/gal-img.html deleted file mode 100644 index ae7d23e..0000000 --- a/layouts/shortcodes/gal-img.html +++ /dev/null @@ -1,16 +0,0 @@ -{{- $src := .Get "src" -}} -{{- $source := resources.Get $src -}} -{{- $alt := .Get "alt" -}} -{{- $caption := .Get "caption" -}} -{{- $location := .Get "location" -}} -{{- $fullsize := $source -}} -{{- $thumb := $source.Resize "400x webp" -}} -
    - {{ $alt }} - {{ with $caption }}
    {{ . }}
    {{ end }} -
    diff --git a/layouts/shortcodes/gallery.html b/layouts/shortcodes/gallery.html index f9e546e..b66c327 100644 --- a/layouts/shortcodes/gallery.html +++ b/layouts/shortcodes/gallery.html @@ -1,3 +1,12 @@ -
    - {{ .Inner }} +{{- $cols := .Get "cols" | default "2" -}} + +
    + {{- range $line := strings.Split .Inner "\n" -}} + {{- if strings.Contains $line "![" -}} + {{- $image := strings.TrimSpace $line -}} + {{- if $image -}} + {{ $image | markdownify | safeHTML }} + {{- end -}} + {{- end -}} + {{- end -}}
    diff --git a/layouts/shortcodes/gravatar.html b/layouts/shortcodes/gravatar.html index 56e2514..3a1ebcc 100644 --- a/layouts/shortcodes/gravatar.html +++ b/layouts/shortcodes/gravatar.html @@ -1,52 +1,17 @@ -{{/* - * The gravatar shortcode: - * All arguments are optional, main ones are mail and size and have a fallback set in place. - * Args: - * mail: [string] The email address. Falls back to .Site.Params.author_email which should be set in your config file. - * size: [int] The size of the fetched image. Defaults to 200 if not set. - * class: [string] The class to give to the figure block. - * link: [string] The address to link the picture to. - * target: [string] Where to open the link. One of "_blank", "_self", "_parent", "_top". - * caption: [string] Caption text to show with the image. Supports Markdown. - * - * Usage: - * {{< gravatar mail="some@address.com" size=150 class="some class" link="https://example.com" target="_blank" rel="author" caption="Here's a picture of a dog." >}} - * - * Output: - *
    - * - *
    - *

    - * Here's a picture of a dog. - *

    - *
    - *
    - * - */}} +{{- $email := .Get "email" -}} +{{- $size := .Get "size" | default "256" | int -}} +{{- $alt := .Get "alt" | default "User avatar" -}} +{{- $class := .Get "class" | default "w-32 h-32 rounded-full" -}} -{{- $mailhash := $.Site.Params.author_email -}} -{{- if .Get "mail" -}}{{- $mailhash = .Get "mail" -}}{{- end -}} -{{- $hash := $mailhash | lower | md5 -}} - - -{{- if .Get "link" -}} - -{{- end }} - {{ with .Get -{{- if .Get "link" -}} - -{{- end }} -{{- if .Get "caption" -}} -
    -

    - {{- .Get "caption" | markdownify -}} -

    -
    -{{- end }} - +{{- if $email -}} + {{- $hash := md5 (strings.TrimSpace (strings.ToLower $email)) -}} + {{- $gravatarURL := printf "https://www.gravatar.com/avatar/%s?s=%d&d=identicon" $hash $size -}} + {{ $alt }} +{{- else -}} + {{- errorf "gravatar shortcode: 'email' parameter is required" -}} +{{- end -}} diff --git a/layouts/shortcodes/image.html b/layouts/shortcodes/image.html new file mode 100644 index 0000000..84dec3f --- /dev/null +++ b/layouts/shortcodes/image.html @@ -0,0 +1,23 @@ +{{- $src := .Get "src" -}} +{{- $alt := .Get "alt" | default "Image" -}} +{{- $caption := .Get "caption" -}} +{{- $class := .Get "class" | default "w-full h-auto rounded-lg border border-border" -}} +{{- $link := .Get "link" -}} +{{- $figureClass := .Get "figure-class" -}} + +{{- if or $src .Inner -}} +
    + {{- if .Inner -}} + {{- .Inner -}} + {{- else -}} + {{- if $link -}}{{- end -}} + {{ $alt }} + {{- if $link -}}{{- end -}} + {{- end -}} + {{- if $caption -}} +
    {{ $caption }}
    + {{- end -}} +
    +{{- else -}} + {{- errorf "image shortcode: 'src' parameter or inner content is required" -}} +{{- end -}} diff --git a/layouts/shortcodes/img.html b/layouts/shortcodes/img.html deleted file mode 100644 index fbf96c0..0000000 --- a/layouts/shortcodes/img.html +++ /dev/null @@ -1,84 +0,0 @@ -{{/* - Taken from https://www.brycewray.com/posts/2022/06/responsive-optimized-images-hugo/ -*/}} - -{{- $respSizes := .Site.Params.imageSizes -}} -{{- $src := .Get "src" -}} -{{- $source := resources.Get $src -}} -{{- $alt := .Get "alt" -}} -{{- $divClass := .Get "divClass" -}} -{{/* - The styling in $imgClass, below, makes - an image fill the container horizontally - and adjust its height automatically - for that, and then fade in for the LQIP effect. - Feel free to adjust your CSS/SCSS as desired. -*/}} -{{- $imgClass := "animate-fade" -}} -{{- $dataSzes := "(min-width: 1024px) 100vw, 50vw" -}} -{{/* - Now we'll create the 20-pixel-wide LQIP - and turn it into Base64-encoded data, which - is better for performance and caching. -*/}} -{{- $LQIP_img := $source.Resize "20x jpg" -}} -{{- $LQIP_b64 := $LQIP_img.Content | base64Encode -}} -{{/* - $CFPstyle is for use in styling - the div's background, as you'll see shortly. -*/}} -{{- $CFPstyle := printf "%s%s%s%v%s" "background: url(data:image/jpeg;base64," $LQIP_b64 "); background-size: cover; background-repeat: no-repeat; width: " $source.Width "px;" -}} -{{/* - Then, we create a 640-pixel-wide JPG - of the image. This will serve as the - "fallback" image for that tiny percentage - of browsers that don't understand the - HTML `picture` tag. -*/}} -{{- $actualImg := $source.Resize "640x jpg" -}} -
    -{{/* - Now we'll build the `picture` which modern - browsers use to decide which image, and - which format thereof, to show. Remember to - put `webp` first, since the browser will use - the first format it **can** use, and WebP files - usually are smaller. After WebP, the fallback - is the universally safe JPG format. -*/}} - - - - - {{ $alt }} - - -
    diff --git a/layouts/shortcodes/quote.html b/layouts/shortcodes/quote.html index 05d0c94..1ed5c3c 100644 --- a/layouts/shortcodes/quote.html +++ b/layouts/shortcodes/quote.html @@ -1,19 +1,15 @@ -
    -

    - {{.Inner}} -

    - {{ if .Get "source" }} - - {{ end }} +{{- $source := .Get "source" -}} +{{- $src := .Get "src" -}} + +
    +

    {{ .Inner }}

    + {{- if $source -}} +
    + {{- if $src -}} + โ€” {{ $source }} + {{- else -}} + โ€” {{ $source }} + {{- end -}} +
    + {{- end -}}
    diff --git a/layouts/shortcodes/strike.html b/layouts/shortcodes/strike.html index 415036a..275b7c1 100644 --- a/layouts/shortcodes/strike.html +++ b/layouts/shortcodes/strike.html @@ -1 +1 @@ -{{ .Inner | markdownify }} +{{ .Inner }} diff --git a/layouts/shortcodes/svg.html b/layouts/shortcodes/svg.html deleted file mode 100644 index d042bb0..0000000 --- a/layouts/shortcodes/svg.html +++ /dev/null @@ -1,5 +0,0 @@ - -{{- $fname := print "SVGs/" ( .Get "name" ) ".svg" -}} -{{ $icon := resources.Get $fname }} -{{ $icon.Content | safeHTML }} - diff --git a/layouts/shortcodes/video.html b/layouts/shortcodes/video.html index aa30a13..1e2645d 100644 --- a/layouts/shortcodes/video.html +++ b/layouts/shortcodes/video.html @@ -1,37 +1,37 @@ -{{/* - * The video shortcode: - * All arguments are optional, except for src which is where you define your video file - * This shortcode supports webm, mp4, and other HTML5 video formats. - * Args: - * src: [string] Path to video file (required) - * class: [string] The class(es) to give to the video block. - * width: [int] The width of the video - * height: [int] The height of the video - * autoplay: [bool] true or false for autoplay - defaults to false - * loop: [bool] true or false for loop - defaults to false - * muted: [bool] true or false for mute - defaults to false - * - * Usage: - * {{< video src="my-video.mp4" width=600 height=400 autoplay=true loop=true muted=true class="responsive-video" >}} - * - * Output: - * - * - */}} +{{- $src := .Get "src" -}} +{{- $id := .Get "id" -}} +{{- $title := .Get "title" | default "Video" -}} +{{- $class := .Get "class" | default "" -}} -{{ $ext := (.Get "src") | path.Ext }} -{{ $filetype := slicestr $ext 1}} - - - - +{{- if $id -}} +
    + +
    +{{- else if $src -}} + {{- $ext := $src | path.Ext -}} + {{- $filetype := slicestr $ext 1 -}} + {{- $videoURL := $src -}} + {{- $resource := .Page.Resources.GetMatch $src -}} + {{- if $resource -}}{{- $videoURL = $resource.RelPermalink -}}{{- end -}} + +{{- else -}} + {{- errorf "video shortcode: either 'src' or 'id' parameter is required" -}} +{{- end -}} diff --git a/layouts/taxonomy.html b/layouts/taxonomy.html deleted file mode 100644 index c2e7875..0000000 --- a/layouts/taxonomy.html +++ /dev/null @@ -1,7 +0,0 @@ -{{ define "main" }} -

    {{ .Title }}

    - {{ .Content }} - {{ range .Pages }} -

    {{ .LinkTitle }}

    - {{ end }} -{{ end }} diff --git a/layouts/taxonomy/list.html b/layouts/taxonomy/list.html new file mode 100644 index 0000000..c3a4317 --- /dev/null +++ b/layouts/taxonomy/list.html @@ -0,0 +1,49 @@ +{{ define "main" }} +
    + +

    + {{ i18n .Data.Plural }} +

    + + +
    + {{ $pinned := where .Pages "Params.pinned" true }} + {{ $unpinned := where .Pages "Params.pinned" false }} + + + {{ if eq (len $unpinned) 0 }} + {{ $unpinned = where .Pages "Params.pinned" nil }} + {{ if eq (len $unpinned) 0 }} + {{ $unpinned = where .Pages "Params.pinned" "" }} + {{ end }} + {{ end }} + + + {{ range (sort $pinned "Date" "desc") }} +
    + {{ partial "article-card.html" . }} + + {{ i18n "postCount" .Pages.Len }} + +
    + {{ end }} + + + {{ range (sort $unpinned "Date" "desc") }} +
    + {{ partial "article-card.html" . }} + + {{ i18n "postCount" .Pages.Len }} + +
    + {{ end }} + + + {{ if eq (len .Pages) 0 }} +
    + {{ i18n "noRelated" }} +
    + {{ end }} +
    +
    +{{ end }} diff --git a/layouts/taxonomy/term.html b/layouts/taxonomy/term.html new file mode 100644 index 0000000..1b953bc --- /dev/null +++ b/layouts/taxonomy/term.html @@ -0,0 +1,46 @@ +{{ define "main" }} +
    + +

    + {{ i18n .Data.Singular }} +

    + + +

    + + {{ .Title }} + +

    + + +
    + {{ $pinned := where .Pages "Params.pinned" true }} + {{ $unpinned := where .Pages "Params.pinned" false }} + + + {{ if eq (len $unpinned) 0 }} + {{ $unpinned = where .Pages "Params.pinned" nil }} + {{ if eq (len $unpinned) 0 }} + {{ $unpinned = where .Pages "Params.pinned" "" }} + {{ end }} + {{ end }} + + + {{ range (sort $pinned "Date" "desc") }} + {{ partial "article-card.html" . }} + {{ end }} + + + {{ range (sort $unpinned "Date" "desc") }} + {{ partial "article-card.html" . }} + {{ end }} + + + {{ if eq (len .Pages) 0 }} +
    + {{ i18n "noRelated" }} +
    + {{ end }} +
    +
    +{{ end }} diff --git a/layouts/term.html b/layouts/term.html deleted file mode 100644 index c2e7875..0000000 --- a/layouts/term.html +++ /dev/null @@ -1,7 +0,0 @@ -{{ define "main" }} -

    {{ .Title }}

    - {{ .Content }} - {{ range .Pages }} -

    {{ .LinkTitle }}

    - {{ end }} -{{ end }} -- cgit v1.2.3