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

@@ -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 }}