Add article thumb, cover and feature images

This commit is contained in:
James Panther
2022-11-09 09:30:26 +11:00
parent ca1f739eca
commit c9cf3c5f6b
26 changed files with 141 additions and 44 deletions
+14
View File
@@ -1,4 +1,7 @@
{{ define "main" }}
{{- $images := .Resources.ByType "image" }}
{{- $cover := $images.GetMatch "*cover*" }}
{{- $feature := $images.GetMatch "*feature*" | default $cover }}
<article>
<header class="max-w-prose">
{{ if .Params.showBreadcrumbs | default (.Site.Params.article.showBreadcrumbs | default false) }}
@@ -10,6 +13,17 @@
<div class="mt-8 mb-12 text-base text-neutral-500 dark:text-neutral-400 print:hidden">
{{ partial "article-meta.html" (dict "context" . "scope" "single") }}
</div>
{{ with $feature }}
<img
class="mb-6 -mt-4 rounded-md"
srcset="
{{- (.Resize "330x").RelPermalink }} 330w,
{{- (.Resize "660x").RelPermalink }} 660w,
{{- (.Resize "1024x").RelPermalink }} 1024w,
{{- (.Resize "1320x").RelPermalink }} 2x"
src="{{ (.Resize "660x").RelPermalink }}"
/>
{{ end }}
</header>
<section class="flex flex-col max-w-full mt-0 prose dark:prose-invert lg:flex-row">
{{ if and (.Params.showTableOfContents | default (.Site.Params.article.showTableOfContents | default false)) (in .TableOfContents "<ul") }}