Reorganize partials

Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
2025-08-14 17:27:01 +03:00
parent 39779cdc88
commit 2200d995ce
21 changed files with 56 additions and 47 deletions

View File

@@ -1,5 +1,5 @@
{{ partial "image/index.html" (dict
"path" .Destination
{{ partial "components/image/index.html" (dict
"src" .Destination
"caption" .Text
"alt" .Title
)

View File

@@ -1,41 +1,14 @@
<!doctype html>
<html lang="{{- .Site.LanguageCode -}}">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
{{ partial "components/head/index.html" . }}
<title>
{{- if .IsHome -}}
{{ .Site.Title }}
{{- else -}}
{{ .Site.Title }} &middot;
{{ .Title }}
{{- end -}}
</title>
{{ with .Site.Params.description }}
<meta name="description" content="{{- . -}}" />
{{ end }}
<meta name="viewport" content="width=device-width, initial-scale=1" />
{{ partial "head/bots.html" . }}
{{ partial "head/rss.html" . }}
{{ partial "head/opengraph.html" . }}
{{ partial "head/twitter.html" . }}
{{ partial "head/js.html" . }}
{{ partial "head/css.html" . }}
</head>
<body>
{{ partial "header.html" . }}
{{ partial "components/header.html" . }}
{{ block "main" . }}
{{ end }}
{{ partial "footer.html" . }}
{{ partial "components/footer.html" . }}
</body>
</html>

View File

@@ -2,7 +2,7 @@
{{ $withMeta := default true .Params.withMeta }}
<main class="{{- if $withMeta -}}with-meta{{- end -}}">
{{ if $withMeta }}
{{ partial "list/meta.html" . }}
{{ partial "components/list/meta.html" . }}
{{ end }}
<div class="content">
{{ partial "posts/list.html" . }}

View File

@@ -1,6 +1,6 @@
{{ define "main" }}
<main>
{{ partial "posts/hero.html" . }}
{{ partial "components/hero/default.html" . }}
<div class="content">
{{ .Content }}
</div>

View File

@@ -2,7 +2,7 @@
{{ $withMeta := default true .Params.withMeta }}
<main class="{{- if $withMeta -}}with-meta{{- end -}}">
{{ if $withMeta }}
{{ partial "list/meta.html" . }}
{{ partial "components/list/meta.html" . }}
{{ end }}
<div class="{{- if $withMeta -}}content{{- else -}}content wide{{- end -}}">
{{ partial "gallery/list.html" . }}

View File

@@ -0,0 +1,29 @@
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>
{{- if .IsHome -}}
{{ .Site.Title }}
{{- else -}}
{{ .Site.Title }} &middot;
{{ .Title }}
{{- end -}}
</title>
{{ with .Site.Params.description }}
<meta name="description" content="{{- . -}}" />
{{ end }}
<meta name="viewport" content="width=device-width, initial-scale=1" />
{{ partial "components/head/bots.html" . }}
{{ partial "components/head/rss.html" . }}
{{ partial "components/head/opengraph.html" . }}
{{ partial "components/head/twitter.html" . }}
{{ partial "components/head/js.html" . }}
{{ partial "components/head/css.html" . }}
</head>

View File

@@ -0,0 +1,8 @@
{{ with .OutputFormats.Get "RSS" }}
<link
href="{{- .Permalink -}}"
rel="{{- .Rel -}}"
type="{{- .MediaType.Type -}}"
title="{{- $.Site.Title -}}"
/>
{{ end }}

View File

@@ -5,5 +5,5 @@
&middot;
<span class="duration">{{ printf "%d MIN READ" .ReadingTime }}</span>
</div>
{{ partial "image/index.html" .Params.hero }}
{{ partial "components/image/index.html" .Params.hero }}
</section>

View File

@@ -1,4 +1,4 @@
{{ $imageData := partial "image/reflect.html" . }}
{{ $imageData := partial "components/image/reflect.html" . }}
{{- with $imageData.image -}}
<figure class="captioned-image lightbox">
<a
@@ -15,7 +15,7 @@
{{ with $imageData.alt }}alt="{{- . -}}"{{ end }}
/>
</a>
{{ with $imageData.title }}
{{ with $imageData.caption }}
<figcaption>{{ . }}</figcaption>
{{ end }}
</figure>

View File

@@ -1,16 +1,18 @@
{{- $input := . -}}
{{- $src := $input -}}
{{- $caption := "" -}}
{{- $title := "" -}}
{{- $alt := "" -}}
{{- if reflect.IsMap $input -}}
{{- $src = $input.src | default $input.path | default "" -}}
{{- $title = $input.title | default $input.caption | default "" -}}
{{- $alt = $input.alt | default $title -}}
{{- $src = $input.src | default "" -}}
{{- $caption = $input.caption | default "" -}}
{{- $title = $input.title | default $caption | default "" -}}
{{- $alt = $input.alt | default $title | default "" -}}
{{- end -}}
{{ $result := dict "image" nil "title" $title "alt" $alt }}
{{ $result := dict "image" nil "caption" $caption "title" $title "alt" $alt }}
{{- if $src -}}
{{- $isRemote := strings.HasPrefix $src "http" -}}
@@ -23,7 +25,7 @@
{{- $image = resources.Get $src -}}
{{- end -}}
{{- $result = (dict "image" $image "title" $title "alt" $alt) -}}
{{- $result = (dict "image" $image "caption" $caption "title" $title "alt" $alt) -}}
{{- end -}}
{{- return $result -}}

View File

@@ -2,7 +2,7 @@
<div class="grid-sizer"></div>
{{ range sort .Pages "Date" "desc" }}
{{ if not .Params.private }}
{{ $imageData := partial "image/reflect.html" .Params.hero }}
{{ $imageData := partial "components/image/reflect.html" .Params.hero }}
{{ with $imageData.image }}
<div class="image grid-item">
<a

View File

@@ -1,3 +0,0 @@
{{ with .OutputFormats.Get "RSS" }}
<link href="{{- .Permalink -}}" rel="{{- .Rel -}}" type="{{- .MediaType.Type -}}" title="{{- $.Site.Title -}}" />
{{ end }}