From 6a583db0ac533d88f551fbe4d15a10f4b038da98 Mon Sep 17 00:00:00 2001 From: Oscar Najera Date: Sat, 21 Oct 2023 19:09:25 +0200 Subject: Hero avoid duplication --- layouts/_default/about.html | 37 +------------------------------------ layouts/partials/hero.html | 44 ++++++++++++++++++++++++++++++++++++++------ 2 files changed, 39 insertions(+), 42 deletions(-) diff --git a/layouts/_default/about.html b/layouts/_default/about.html index 3aaa361..a88a9b1 100644 --- a/layouts/_default/about.html +++ b/layouts/_default/about.html @@ -1,40 +1,5 @@ {{ define "hero" }} -
-
- {{ $avatar := index .Params.images 1 }} - {{ if hasPrefix $avatar "http" }} - {{ $avatar = resources.GetRemote $avatar }} - {{ else }} - {{ $avatar = resources.Get $avatar }} - {{ end }} - {{ with $avatar }} - - {{ end }} -

- {{ .Title }} -

- - {{ with .Params.Subtitle }} -

- {{ . | markdownify }} -

- {{ end }} - - -
- {{ if .Params.personal }} - {{ partial "social_links" .Site.Author }} - {{ else }} - {{ partial "social_links" .Site.Params }} - {{ end }} -
-
-
+ {{ partial "hero.html" . }} {{ end }} {{ define "main" }} diff --git a/layouts/partials/hero.html b/layouts/partials/hero.html index 5acafde..93edc74 100644 --- a/layouts/partials/hero.html +++ b/layouts/partials/hero.html @@ -1,11 +1,43 @@
-
-

{{ .Title }}

- {{ .Content }} +
+ {{ if eq .Type "about" }} + {{ $avatar := index .Params.images 1 }} + {{ if hasPrefix $avatar "http" }} + {{ $avatar = resources.GetRemote $avatar }} + {{ else }} + {{ $avatar = resources.Get $avatar }} + {{ end }} + {{ with $avatar }} + + {{ end }} +

+ {{ .Title }} +

+ + {{ with .Params.Subtitle }} +

+ {{ . | markdownify }} +

+ {{ end }} + + +
+ {{ if .Params.personal }} + {{ partial "social_links" .Site.Author }} + {{ else }} + {{ partial "social_links" .Site.Params }} + {{ end }} +
+ {{ else }} + +

{{ .Title }}

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