This commit is contained in:
Nuno Coração 2024-02-10 17:54:51 +00:00
parent 14e464731c
commit e87e066aa7
9 changed files with 82 additions and 58 deletions

View file

@ -13,6 +13,10 @@
{{- $images := $.Resources.ByType "image" -}} {{- $images := $.Resources.ByType "image" -}}
{{- $featured := $images.GetMatch "*feature*" -}} {{- $featured := $images.GetMatch "*feature*" -}}
{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}} {{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
{{ if and .Params.featureimage (not $featured) }}
{{- $url:= .Params.featureimage -}}
{{ $featured = resources.GetRemote $url }}
{{ end }}
{{- if not $featured }}{{ with .Site.Params.defaultFeaturedImage }}{{ $featured = resources.Get . }}{{ end }}{{ end -}} {{- if not $featured }}{{ with .Site.Params.defaultFeaturedImage }}{{ $featured = resources.Get . }}{{ end }}{{ end -}}
{{- with $featured -}} {{- with $featured -}}
{{ if $disableImageOptimization }} {{ if $disableImageOptimization }}

View file

@ -13,6 +13,10 @@
{{- $images := $.Resources.ByType "image" -}} {{- $images := $.Resources.ByType "image" -}}
{{- $featured := $images.GetMatch "*feature*" -}} {{- $featured := $images.GetMatch "*feature*" -}}
{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}} {{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
{{ if and .Params.featureimage (not $featured) }}
{{- $url:= .Params.featureimage -}}
{{ $featured = resources.GetRemote $url }}
{{ end }}
{{- if not $featured }}{{ with .Site.Params.defaultFeaturedImage }}{{ $featured = resources.Get . }}{{ end }}{{ end -}} {{- if not $featured }}{{ with .Site.Params.defaultFeaturedImage }}{{ $featured = resources.Get . }}{{ end }}{{ end -}}
{{ if .Params.hideFeatureImage }}{{ $featured = false }}{{ end }} {{ if .Params.hideFeatureImage }}{{ $featured = false }}{{ end }}
{{- with $featured -}} {{- with $featured -}}

View file

@ -40,9 +40,9 @@
{{- $images := $.Resources.ByType "image" -}} {{- $images := $.Resources.ByType "image" -}}
{{- $featured := $images.GetMatch "*feature*" -}} {{- $featured := $images.GetMatch "*feature*" -}}
{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}} {{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
{{ if .Params.featureimage }} {{ if and .Params.featureimage (not $featured) }}
{{- $url:= .Params.featureimage -}} {{- $url:= .Params.featureimage -}}
{{- if not $featured }}{{ $featured = resources.GetRemote $url }}{{ end -}} {{ $featured = resources.GetRemote $url }}
{{ end }} {{ end }}
{{- if not $featured }}{{ with .Site.Params.defaultFeaturedImage }}{{ $featured = resources.Get . }}{{ end }}{{ end -}} {{- if not $featured }}{{ with .Site.Params.defaultFeaturedImage }}{{ $featured = resources.Get . }}{{ end }}{{ end -}}
{{ if .Params.hideFeatureImage }}{{ $featured = false }}{{ end }} {{ if .Params.hideFeatureImage }}{{ $featured = false }}{{ end }}

View file

@ -9,7 +9,7 @@
<img class="!mt-0 !mb-0 h-24 w-24 rounded-full ltr:mr-4 rtl:ml-4" width="96" height="96" <img class="!mt-0 !mb-0 h-24 w-24 rounded-full ltr:mr-4 rtl:ml-4" width="96" height="96"
src="{{ $authorImage.RelPermalink }}" /> src="{{ $authorImage.RelPermalink }}" />
{{ else }} {{ else }}
{{ $authorImage := resources.GetRmeote . }} {{ $authorImage := resources.GetRemote . }}
{{ if not $disableImageOptimization }} {{ if not $disableImageOptimization }}
{{ $authorImage = $authorImage.Fill "192x192" }} {{ $authorImage = $authorImage.Fill "192x192" }}
{{ end }} {{ end }}

View file

@ -4,10 +4,9 @@
{{- $featured := $images.GetMatch "*background*" -}} {{- $featured := $images.GetMatch "*background*" -}}
{{- if not $featured }}{{ $featured = $images.GetMatch "*feature*" }}{{ end -}} {{- if not $featured }}{{ $featured = $images.GetMatch "*feature*" }}{{ end -}}
{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}} {{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
{{ if .Params.featureimage }} {{ if and .Params.featureimage (not $featured) }}
{{- $url:= .Params.featureimage -}} {{- $url:= .Params.featureimage -}}
{{if or $.Site.Params.list.showHero $.Site.Params.term.showHero $.Site.Params.taxonomy.showHero}} {{ $url = default $.Site.Params.homepage.homepageImage $.Site.Params.defaultBackgroundImage }} {{end}} {{ $featured = resources.GetRemote $url }}
{{- if not $featured }}{{ $featured = resources.GetRemote $url }}{{ end -}}
{{ end }} {{ end }}
{{- if not $featured }}{{ with .Site.Params.defaultBackgroundImage }}{{ $featured = resources.Get . }}{{ end }}{{ end -}} {{- if not $featured }}{{ with .Site.Params.defaultBackgroundImage }}{{ $featured = resources.Get . }}{{ end }}{{ end -}}
{{ $isParentList := eq (.Scratch.Get "scope") "list" }} {{ $isParentList := eq (.Scratch.Get "scope") "list" }}

View file

@ -6,9 +6,21 @@
<div class="relative sm:overflow-hidden"> <div class="relative sm:overflow-hidden">
<div class="fixed inset-x-0 top-0" style="z-index:-10"> <div class="fixed inset-x-0 top-0" style="z-index:-10">
{{ $homepageImage := "" }} {{ $homepageImage := "" }}
{{ with .Site.Params.defaultBackgroundImage }} {{ $homepageImage = resources.Get . }} {{if not $homepageImage}} {{ $homepageImage = resources.GetRemote . }} {{ end }} {{ end }} {{ with .Site.Params.defaultBackgroundImage }}
{{ with .Site.Params.homepage.homepageImage }} {{ $homepageImage = resources.Get . }} {{if not $homepageImage}} {{ $homepageImage = resources.GetRemote . }} {{ end }} {{ end }} {{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }}
{{ if not (eq $homepageImage "") }} {{ $homepageImage = resources.GetRemote . }}
{{ else }}
{{ $homepageImage = resources.Get . }}
{{ end }}
{{ end }}
{{ with .Site.Params.homepage.homepageImage }}
{{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }}
{{ $homepageImage = resources.GetRemote . }}
{{ else }}
{{ $homepageImage = resources.Get . }}
{{ end }}
{{ end }}
{{ if $homepageImage }}
<img class="w-full h-[1000px] object-cover m-0 nozoom" src="{{ $homepageImage.RelPermalink }}" role="presentation"> <img class="w-full h-[1000px] object-cover m-0 nozoom" src="{{ $homepageImage.RelPermalink }}" role="presentation">
<div <div
class="absolute inset-0 h-[1000px] bg-gradient-to-t from-neutral dark:from-neutral-800 to-transparent mix-blend-normal"> class="absolute inset-0 h-[1000px] bg-gradient-to-t from-neutral dark:from-neutral-800 to-transparent mix-blend-normal">
@ -20,22 +32,19 @@
</div> </div>
<div class="relative px-8 py-16 flex flex-col items-center justify-center text-center"> <div class="relative px-8 py-16 flex flex-col items-center justify-center text-center">
{{ with .Site.Author.image }} {{ with .Site.Author.image }}
{{ $authorImage := resources.Get . }} {{ $authorImage := "" }}
{{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }}
{{ $authorImage = resources.GetRemote . }}
{{ else }}
{{ $authorImage = resources.Get . }}
{{ end }}
{{ if $authorImage }} {{ if $authorImage }}
{{ if not $disableImageOptimization }}
{{ $authorImage = $authorImage.Fill "288x288" }}
{{ end }}
<img class="mb-2 rounded-full h-36 w-36" width="144" height="144"
alt="{{ $.Site.Author.name | default " Author" }}" src="{{ $authorImage.RelPermalink }}" />
{{else}}
{{ $authorImage := resources.GetRemote . }}
{{ if not $disableImageOptimization }} {{ if not $disableImageOptimization }}
{{ $authorImage = $authorImage.Fill "288x288" }} {{ $authorImage = $authorImage.Fill "288x288" }}
{{ end }} {{ end }}
<img class="mb-2 rounded-full h-36 w-36" width="144" height="144" <img class="mb-2 rounded-full h-36 w-36" width="144" height="144"
alt="{{ $.Site.Author.name | default " Author" }}" src="{{ $authorImage.RelPermalink }}" /> alt="{{ $.Site.Author.name | default " Author" }}" src="{{ $authorImage.RelPermalink }}" />
{{ end }} {{ end }}
{{ end }} {{ end }}
<h1 class="mb-2 text-4xl font-extrabold text-neutral-800 dark:text-neutral-200"> <h1 class="mb-2 text-4xl font-extrabold text-neutral-800 dark:text-neutral-200">
{{ .Site.Author.name | default .Site.Title }} {{ .Site.Author.name | default .Site.Title }}

View file

@ -15,8 +15,20 @@
<div class="mt-6 sm:mt-16 lg:mt-0 mx-auto max-w-xl px-4 sm:px-6 lg:mx-0 lg:max-w-none lg:py-16 lg:px-0"> <div class="mt-6 sm:mt-16 lg:mt-0 mx-auto max-w-xl px-4 sm:px-6 lg:mx-0 lg:max-w-none lg:py-16 lg:px-0">
<div class="-mr-48 md:-mr-16 lg:relative lg:m-0 lg:h-full lg:px-0" style="width:100%"> <div class="-mr-48 md:-mr-16 lg:relative lg:m-0 lg:h-full lg:px-0" style="width:100%">
{{ $homepageImage := "" }} {{ $homepageImage := "" }}
{{ with .Site.Params.defaultBackgroundImage }}{{ $homepageImage = resources.Get . }}{{ end }} {{ with .Site.Params.defaultBackgroundImage }}
{{ with .Site.Params.homepage.homepageImage }}{{ $homepageImage = resources.Get . }}{{ end }} {{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }}
{{ $homepageImage = resources.GetRemote . }}
{{ else }}
{{ $homepageImage = resources.Get . }}
{{ end }}
{{ end }}
{{ with .Site.Params.homepage.homepageImage }}
{{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }}
{{ $homepageImage = resources.GetRemote . }}
{{ else }}
{{ $homepageImage = resources.Get . }}
{{ end }}
{{ end }}
{{ if $homepageImage }} {{ if $homepageImage }}
<img class="w-full rounded-xl shadow-xl lg:absolute lg:left-0 lg:h-full lg:w-auto lg:max-w-none" <img class="w-full rounded-xl shadow-xl lg:absolute lg:left-0 lg:h-full lg:w-auto lg:max-w-none"
src="{{ $homepageImage.RelPermalink }}"> src="{{ $homepageImage.RelPermalink }}">

View file

@ -6,8 +6,20 @@
<div class="relative shadow-xl sm:overflow-hidden rounded-2xl"> <div class="relative shadow-xl sm:overflow-hidden rounded-2xl">
<div class="absolute inset-0"> <div class="absolute inset-0">
{{ $homepageImage := "" }} {{ $homepageImage := "" }}
{{ with .Site.Params.defaultBackgroundImage }}{{ $homepageImage = resources.Get . }}{{ end }} {{ with .Site.Params.defaultBackgroundImage }}
{{ with .Site.Params.homepage.homepageImage }}{{ $homepageImage = resources.Get . }}{{ end }} {{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }}
{{ $homepageImage = resources.GetRemote . }}
{{ else }}
{{ $homepageImage = resources.Get . }}
{{ end }}
{{ end }}
{{ with .Site.Params.homepage.homepageImage }}
{{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }}
{{ $homepageImage = resources.GetRemote . }}
{{ else }}
{{ $homepageImage = resources.Get . }}
{{ end }}
{{ end }}
{{ if $homepageImage }} {{ if $homepageImage }}
<img class="h-full w-full object-cover m-0 nozoom" src="{{ $homepageImage.RelPermalink }}"> <img class="h-full w-full object-cover m-0 nozoom" src="{{ $homepageImage.RelPermalink }}">
<div <div
@ -17,15 +29,13 @@
</div> </div>
<div class="relative px-4 py-16 sm:px-6 sm:py-24 lg:py-32 lg:px-8 flex flex-col items-center justify-center text-center"> <div class="relative px-4 py-16 sm:px-6 sm:py-24 lg:py-32 lg:px-8 flex flex-col items-center justify-center text-center">
{{ with .Site.Author.image }} {{ with .Site.Author.image }}
{{ $authorImage := resources.Get . }} {{ $authorImage := "" }}
{{ if $authorImage }} {{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }}
{{ if not $disableImageOptimization }} {{ $authorImage = resources.GetRemote . }}
{{ $authorImage = $authorImage.Fill "288x288" }}
{{ end }}
<img class="mb-2 rounded-full h-36 w-36" width="144" height="144"
alt="{{ $.Site.Author.name | default " Author" }}" src="{{ $authorImage.RelPermalink }}" />
{{ else }} {{ else }}
{{ $authorImage := resources.GetRemote . }} {{ $authorImage = resources.Get . }}
{{ end }}
{{ if $authorImage }}
{{ if not $disableImageOptimization }} {{ if not $disableImageOptimization }}
{{ $authorImage = $authorImage.Fill "288x288" }} {{ $authorImage = $authorImage.Fill "288x288" }}
{{ end }} {{ end }}

View file

@ -1,44 +1,30 @@
{{ $disableImageOptimization := .Site.Params.disableImageOptimization | default false }} {{ $disableImageOptimization := .Site.Params.disableImageOptimization | default false }}
<article <article class="{{ if not .Site.Params.homepage.showRecent }}
class="{{ if not .Site.Params.homepage.showRecent }}
h-full h-full
{{ end }} flex flex-col items-center justify-center text-center" {{ end }} flex flex-col items-center justify-center text-center">
>
<header class="flex flex-col items-center mb-3"> <header class="flex flex-col items-center mb-3">
{{ with .Site.Author.image }} {{ with .Site.Author.image }}
{{ $authorImage := resources.Get . }} {{ $authorImage := "" }}
{{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }}
{{ $authorImage = resources.GetRemote . }}
{{ else }}
{{ $authorImage = resources.Get . }}
{{ end }}
{{ if $authorImage }} {{ if $authorImage }}
{{ if not $disableImageOptimization }} {{ if not $disableImageOptimization }}
{{ $authorImage = $authorImage.Fill "288x288" }} {{ $authorImage = $authorImage.Fill "288x288" }}
{{ end }} {{ end }}
<img <img class="mb-2 rounded-full h-36 w-36" width="144" height="144" alt="{{ $.Site.Author.name | default " Author" }}"
class="mb-2 rounded-full h-36 w-36" src="{{ $authorImage.RelPermalink }}" />
width="144"
height="144"
alt="{{ $.Site.Author.name | default "Author" }}"
src="{{ $authorImage.RelPermalink }}"
/>
{{ else }}
{{ $authorImage := resources.GetRemote . }}
{{ if not $disableImageOptimization }}
{{ $authorImage = $authorImage.Fill "288x288" }}
{{ end }}
<img
class="mb-2 rounded-full h-36 w-36"
width="144"
height="144"
alt="{{ $.Site.Author.name | default "Author" }}"
src="{{ $authorImage.RelPermalink }}"
/>
{{ end }} {{ end }}
{{ end }} {{ end }}
<h1 class="text-4xl font-extrabold"> <h1 class="text-4xl font-extrabold">
{{ .Site.Author.name | default .Site.Title }} {{ .Site.Author.name | default .Site.Title }}
</h1> </h1>
{{ with .Site.Author.headline }} {{ with .Site.Author.headline }}
<h2 class="text-xl text-neutral-500 dark:text-neutral-400"> <h2 class="text-xl text-neutral-500 dark:text-neutral-400">
{{ . | markdownify | emojify }} {{ . | markdownify | emojify }}
</h2> </h2>
{{ end }} {{ end }}
<div class="mt-1 text-2xl"> <div class="mt-1 text-2xl">
{{ partialCached "author-links.html" . }} {{ partialCached "author-links.html" . }}
@ -48,4 +34,4 @@
</article> </article>
<section> <section>
{{ partial "recent-articles/main.html" . }} {{ partial "recent-articles/main.html" . }}
</section> </section>