mirror of
https://github.com/nunocoracao/blowfish.git
synced 2026-01-30 16:31:52 +01:00
100 lines
3.8 KiB
HTML
100 lines
3.8 KiB
HTML
{{/* Used by
|
|
1. list.html and term.html (when the cardView option is not enabled)
|
|
2. Recent articles template (when the cardView option is not enabled)
|
|
3. Shortcode list.html
|
|
*/}}
|
|
{{ $constrainItemsWidth := .Page.Site.Params.list.constrainItemsWidth | default false }}
|
|
|
|
{{ $articleClasses := "flex flex-wrap md:flex-nowrap article relative" }}
|
|
{{ if .Site.Params.list.showCards }}
|
|
{{ $articleClasses = delimit (slice $articleClasses "border border-neutral-200 dark:border-neutral-700 border-2 rounded-md overflow-hidden") " " }}
|
|
{{ else }}
|
|
{{ $articleClasses = delimit (slice $articleClasses "") " " }}
|
|
{{ end }}
|
|
|
|
{{ $articleImageClasses := "w-full md:w-auto h-full thumbnail nozoom" }}
|
|
{{ if .Site.Params.list.showCards }}
|
|
{{ $articleImageClasses = delimit (slice $articleImageClasses "") " " }}
|
|
{{ else }}
|
|
{{ $articleImageClasses = delimit (slice $articleImageClasses "thumbnailshadow md:mr-7") " " }}
|
|
{{ end }}
|
|
|
|
{{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }}
|
|
|
|
{{ $articleInnerClasses := "" }}
|
|
{{ if .Site.Params.list.showCards }}
|
|
{{ $articleInnerClasses = delimit (slice $articleInnerClasses "p-4") " " }}
|
|
{{ else }}
|
|
{{ $articleInnerClasses = delimit (slice $articleInnerClasses "mt-3 md:mt-0") " " }}
|
|
{{ end }}
|
|
|
|
{{ if $constrainItemsWidth }}
|
|
{{ $articleClasses = delimit (slice $articleClasses "max-w-prose") " " }}
|
|
{{ end }}
|
|
|
|
{{ $featured := "" }}
|
|
{{ $featuredURL := "" }}
|
|
{{ if not .Params.hideFeatureImage }}
|
|
{{ with .Params.featureimage }}
|
|
{{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }}
|
|
{{ $featured = resources.GetRemote . }}
|
|
{{ else }}
|
|
{{ $featured = resources.Get . }}
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
{{ if not $featured }}
|
|
{{ $images := $.Resources.ByType "image" }}
|
|
{{ range slice "*feature*" "*cover*" "*thumbnail*" }}
|
|
{{ if not $featured }}{{ $featured = $images.GetMatch . }}{{ end }}
|
|
{{ end }}
|
|
{{ if not $featured }}
|
|
{{ with .Site.Params.defaultFeaturedImage }}{{ $featured = resources.Get . }}{{ end }}
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
{{ with $featured }}
|
|
{{ $featuredURL = .RelPermalink }}
|
|
{{ if not (or $disableImageOptimization (eq .MediaType.SubType "svg")) }}
|
|
{{ $featuredURL = (.Resize "600x").RelPermalink }}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
|
|
<article class="{{ $articleClasses }}">
|
|
{{ with $featuredURL }}
|
|
<div class="{{ $articleImageClasses }}" style="background-image:url({{ . }});"></div>
|
|
{{ end }}
|
|
<div class="{{ $articleInnerClasses }}">
|
|
<header class="items-center text-start text-xl font-semibold">
|
|
<a
|
|
{{ partial "article-link/_external-link.html" . | safeHTMLAttr }}
|
|
class="not-prose before:absolute before:inset-0 decoration-primary-500 dark:text-neutral text-xl font-bold text-neutral-800 hover:underline hover:underline-offset-2">
|
|
<h2>
|
|
{{ .Title | emojify }}
|
|
{{ if .Params.externalUrl }}
|
|
<span class="cursor-default align-top text-xs text-neutral-400 dark:text-neutral-500">
|
|
<span class="rtl:hidden">↗</span>
|
|
<span class="ltr:hidden">↖</span>
|
|
</span>
|
|
{{ end }}
|
|
</h2>
|
|
</a>
|
|
{{ if and .Draft .Site.Params.article.showDraftLabel }}
|
|
<div class="ms-2">{{ partial "badge.html" (i18n "article.draft" | emojify) }}</div>
|
|
{{ end }}
|
|
{{ if templates.Exists "partials/extend-article-link.html" }}
|
|
{{ partial "extend-article-link.html" . }}
|
|
{{ end }}
|
|
</header>
|
|
<div class="text-sm text-neutral-500 dark:text-neutral-400">
|
|
{{ partial "article-meta/basic.html" . }}
|
|
</div>
|
|
{{ if .Params.showSummary | default (.Site.Params.list.showSummary | default false) }}
|
|
<div class="prose dark:prose-invert max-w-fit py-1">{{ .Summary | plainify }}</div>
|
|
{{ end }}
|
|
</div>
|
|
<div class="px-6 pt-4 pb-2"></div>
|
|
</article>
|