Hero images for articles

This commit is contained in:
Nuno Coração
2022-10-15 16:20:41 +01:00
parent c2d01e5dbe
commit 753d821cef
23 changed files with 52 additions and 12 deletions

View File

@@ -1,13 +1,25 @@
{{ define "main" }}
<article>
<header class="max-w-prose">
{{ if .Params.showHero | default (.Site.Params.article.showHero | default false) }}
{{- $images := .Resources.ByType "image" -}}
{{- $featured := $images.GetMatch "*feature*" -}}
{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
{{- with $featured -}}
{{ with .Resize "600x" }}
<div class="w-full h-36 md:h-56 lg:h-72 single_hero nozoom" style="background-image:url({{ .RelPermalink }});"></div>
{{ end }}
{{- end -}}
{{- end -}}
<header class="mt-5 max-w-prose">
{{ if .Params.showBreadcrumbs | default (.Site.Params.article.showBreadcrumbs | default false) }}
{{ partial "breadcrumbs.html" . }}
{{ end }}
<h1 class="mt-0 text-4xl font-extrabold text-neutral-900 dark:text-neutral">
{{ .Title | emojify }}
</h1>
<div class="mt-8 mb-12 text-base text-neutral-500 dark:text-neutral-400 print:hidden">
<div class="mt-4 mb-12 text-base text-neutral-500 dark:text-neutral-400 print:hidden">
{{ partial "article-meta.html" (dict "context" . "scope" "single") }}
</div>
</header>

View File

@@ -1,6 +1,6 @@
<span>
<button id="likes_button"
style="height: 30px; padding-top: 2px; padding-bottom: 4px; padding-left: 10px; padding-right: 10px"
style="height: 28px; padding-top: 2px; padding-bottom: 4px; padding-left: 10px; padding-right: 10px"
class="!rounded-md bg-primary-600 px-4 py-2 !text-neutral !no-underline hover:!bg-primary-500 dark:bg-primary-800 dark:hover:!bg-primary-700"
onclick="process_article()">
<span id="likes_button_heart" style="display:none">{{ partial "icon.html" "heart" }} </span>