congo/layouts/_default/single.html

75 lines
3.1 KiB
HTML
Raw Normal View History

2021-08-11 05:28:33 +00:00
{{ define "main" }}
{{- $images := .Resources.ByType "image" }}
{{- $cover := $images.GetMatch (.Params.cover | default "*cover*") }}
{{- $feature := $images.GetMatch (.Params.feature | default "*feature*") | default $cover }}
2022-01-18 05:24:33 +00:00
<article>
<header class="max-w-prose">
{{ if .Params.showBreadcrumbs | default (.Site.Params.article.showBreadcrumbs | default false) }}
2021-08-18 00:08:06 +00:00
{{ partial "breadcrumbs.html" . }}
{{ end }}
<h1 class="mt-0 text-4xl font-extrabold text-neutral-900 dark:text-neutral">
2021-08-20 07:02:08 +00:00
{{ .Title | emojify }}
</h1>
2022-04-03 03:51:52 +00:00
<div class="mt-8 mb-12 text-base text-neutral-500 dark:text-neutral-400 print:hidden">
2021-08-21 01:42:40 +00:00
{{ partial "article-meta.html" (dict "context" . "scope" "single") }}
2021-08-11 05:28:33 +00:00
</div>
{{ with $feature }}
<div class="prose">
<img
class="mb-6 -mt-4 rounded-md"
{{ if eq .MediaType.SubType "svg" }}
src="{{ .RelPermalink }}"
{{ else }}
{{ if lt .Width 660 }}
src="{{ .RelPermalink }}"
{{ else }}
2023-03-23 17:52:41 +00:00
srcset="
{{- (.Resize "330x").RelPermalink }} 330w,
{{- (.Resize "660x").RelPermalink }} 660w,
{{- (.Resize "1024x").RelPermalink }} 1024w,
{{- (.Resize "1320x").RelPermalink }} 2x"
{{ end }}
{{ end }}
alt="{{ $.Params.featureAlt | default $.Params.coverAlt | default "" }}"
2023-05-26 21:37:02 +00:00
{{ if $.Site.Params.enableImageLazyLoading | default true }}
loading="lazy"
{{ end }}
/>
{{ with $.Params.coverCaption }}
<figcaption class="mb-6 -mt-3 text-center">{{ . | markdownify }}</figcaption>
{{ end }}
</div>
{{ end }}
2021-08-11 05:28:33 +00:00
</header>
<section class="flex flex-col max-w-full mt-0 prose dark:prose-invert lg:flex-row">
2022-01-18 05:24:33 +00:00
{{ if and (.Params.showTableOfContents | default (.Site.Params.article.showTableOfContents | default false)) (in .TableOfContents "<ul") }}
<div class="order-first px-0 lg:order-last lg:max-w-xs lg:ps-8">
<div class="toc pe-5 print:hidden lg:sticky lg:top-10">
2022-01-18 05:24:33 +00:00
{{ partial "toc.html" . }}
</div>
</div>
{{ end }}
<div class="min-w-0 min-h-0 max-w-prose grow">
2022-01-18 05:24:33 +00:00
{{ .Content | emojify }}
</div>
2021-08-11 05:28:33 +00:00
</section>
2022-04-03 03:51:52 +00:00
<footer class="pt-8 max-w-prose print:hidden">
{{ partial "author.html" . }}
2021-08-16 07:06:35 +00:00
{{ partial "sharing-links.html" . }}
{{ partial "article-pagination.html" . }}
{{ if .Params.showComments | default (.Site.Params.article.showComments | default false) }}
{{ if templates.Exists "partials/comments.html" }}
<div class="pt-3">
<hr class="border-dotted border-neutral-300 dark:border-neutral-600" />
<div class="pt-3">
{{ partial "comments.html" . }}
</div>
</div>
{{ else }}
{{ warnf "[CONGO] Comments are enabled for %s but no comments partial exists." .File.Path }}
{{ end }}
{{ end }}
2021-08-11 05:28:33 +00:00
</footer>
</article>
{{ end }}