diff options
author | Christoph Cullmann <cullmann@kde.org> | 2024-04-28 17:33:09 +0200 |
---|---|---|
committer | Christoph Cullmann <cullmann@kde.org> | 2024-04-28 17:33:09 +0200 |
commit | e77051ccc4b47951bfa4fde2be436b1bb2fb113b (patch) | |
tree | f0b75ee3521da9c8cd39dac4359212348f70e4e8 /themes/blowfish/layouts/partials/article-link | |
parent | 4b355837824ac2422d371acef790f0f4249255c7 (diff) |
use https://github.com/nunocoracao/blowfish.git
Diffstat (limited to 'themes/blowfish/layouts/partials/article-link')
3 files changed, 254 insertions, 0 deletions
diff --git a/themes/blowfish/layouts/partials/article-link/card-related.html b/themes/blowfish/layouts/partials/article-link/card-related.html new file mode 100644 index 0000000..c7dbcc3 --- /dev/null +++ b/themes/blowfish/layouts/partials/article-link/card-related.html @@ -0,0 +1,76 @@ +{{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }} +{{ with .Params.externalUrl }} +<a href="{{ . }}" target="_blank" rel="external" class="min-w-full"> + {{ else }} + <a href="{{ .RelPermalink }}" class="min-w-full"> + {{ end }} + <div class="min-h-full border border-neutral-200 dark:border-neutral-700 border-2 rounded overflow-hidden shadow-2xl relative"> + + {{- with $.Params.images -}} + {{- range first 6 . }} + <meta property="og:image" content="{{ . | absURL }}" />{{ end -}} + {{- else -}} + {{- $images := $.Resources.ByType "image" -}} + {{- $featured := $images.GetMatch "*feature*" -}} + {{- 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 -}} + {{- with $featured -}} + {{ if or $disableImageOptimization (strings.HasSuffix $featured ".svg")}} + {{ with . }} + <div class="w-full thumbnail_card_related nozoom" style="background-image:url({{ .RelPermalink }});"></div> + {{ end }} + {{ else }} + {{ with .Resize "600x" }} + <div class="w-full thumbnail_card_related nozoom" style="background-image:url({{ .RelPermalink }});"></div> + {{ end }} + {{ end }} + {{- else -}} + {{- with $.Site.Params.images }} + <meta property="og:image" content="{{ index . 0 | absURL }}" />{{ end -}} + {{- end -}} + {{- end -}} + + + {{ if and .Draft .Site.Params.article.showDraftLabel }} + <span class="absolute top-0 right-0 m-2"> + {{ partial "badge.html" (i18n "article.draft" | emojify) }} + </span> + {{ end }} + + <div class="px-6 py-4"> + + {{ with .Params.externalUrl }} + <div> + <div + class="font-bold text-xl text-neutral-800 decoration-primary-500 hover:underline hover:underline-offset-2 dark:text-neutral"> + {{ $.Title | emojify }} + <span class="text-xs align-top cursor-default text-neutral-400 dark:text-neutral-500"> + <span class="rtl:hidden">↗</span> + <span class="ltr:hidden">↖</span> + </span> + </div> + </div> + {{ else }} + <div class="font-bold text-xl text-neutral-800 decoration-primary-500 hover:underline hover:underline-offset-2 dark:text-neutral" + href="{{ .RelPermalink }}">{{ .Title | emojify }}</div> + {{ end }} + + <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="py-1 prose dark:prose-invert"> + {{ .Summary | emojify }} + </div> + {{ end }} + </div> + <div class="px-6 pt-4 pb-2"> + + </div> + </div> + </a>
\ No newline at end of file diff --git a/themes/blowfish/layouts/partials/article-link/card.html b/themes/blowfish/layouts/partials/article-link/card.html new file mode 100644 index 0000000..dd2a788 --- /dev/null +++ b/themes/blowfish/layouts/partials/article-link/card.html @@ -0,0 +1,77 @@ +{{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }} +{{ with .Params.externalUrl }} +<a href="{{ . }}" target="_blank" rel="external" class="min-w-full"> + {{ else }} + <a href="{{ .RelPermalink }}" class="min-w-full"> + {{ end }} + <div class="min-h-full border border-neutral-200 dark:border-neutral-700 border-2 rounded overflow-hidden shadow-2xl relative"> + + {{- with $.Params.images -}} + {{- range first 6 . }} + <meta property="og:image" content="{{ . | absURL }}" />{{ end -}} + {{- else -}} + {{- $images := $.Resources.ByType "image" -}} + {{- $featured := $images.GetMatch "*feature*" -}} + {{- 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 .Params.hideFeatureImage }}{{ $featured = false }}{{ end }} + {{- with $featured -}} + {{ if or $disableImageOptimization (strings.HasSuffix $featured ".svg")}} + {{ with . }} + <div class="w-full thumbnail_card nozoom" style="background-image:url({{ .RelPermalink }});"></div> + {{ end }} + {{ else }} + {{ with .Resize "600x" }} + <div class="w-full thumbnail_card nozoom" style="background-image:url({{ .RelPermalink }});"></div> + {{ end }} + {{ end }} + {{- else -}} + {{- with $.Site.Params.images }} + <meta property="og:image" content="{{ index . 0 | absURL }}" />{{ end -}} + {{- end -}} + {{- end -}} + + + {{ if and .Draft .Site.Params.article.showDraftLabel }} + <span class="absolute top-0 right-0 m-2"> + {{ partial "badge.html" (i18n "article.draft" | emojify) }} + </span> + {{ end }} + + <div class="px-6 py-4"> + + {{ with .Params.externalUrl }} + <div> + <div + class="font-bold text-xl text-neutral-800 decoration-primary-500 hover:underline hover:underline-offset-2 dark:text-neutral"> + {{ $.Title | emojify }} + <span class="text-xs align-top cursor-default text-neutral-400 dark:text-neutral-500"> + <span class="rtl:hidden">↗</span> + <span class="ltr:hidden">↖</span> + </span> + </div> + </div> + {{ else }} + <div class="font-bold text-xl text-neutral-800 decoration-primary-500 hover:underline hover:underline-offset-2 dark:text-neutral" + href="{{ .RelPermalink }}">{{ .Title | emojify }}</div> + {{ end }} + + <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="py-1 prose dark:prose-invert"> + {{ .Summary | emojify }} + </div> + {{ end }} + </div> + <div class="px-6 pt-4 pb-2"> + + </div> + </div> + </a>
\ No newline at end of file diff --git a/themes/blowfish/layouts/partials/article-link/simple.html b/themes/blowfish/layouts/partials/article-link/simple.html new file mode 100644 index 0000000..afee487 --- /dev/null +++ b/themes/blowfish/layouts/partials/article-link/simple.html @@ -0,0 +1,101 @@ +{{ $constrainItemsWidth := .Page.Site.Params.list.constrainItemsWidth | default false }} + +{{ $articleClasses := "flex flex-wrap article" }} +{{ 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 }} + + +{{ with .Params.externalUrl }} +<a class="{{ $articleClasses }}" href="{{ . }}" target="_blank" rel="external"> + {{ else }} + <a class="{{ $articleClasses }}" href="{{ .RelPermalink }}"> + {{ end }} + {{- with $.Params.images -}} + {{- range first 6 . }} + <meta property="og:image" content="{{ . | absURL }}" />{{ end -}} + {{- else -}} + {{- $images := $.Resources.ByType "image" -}} + {{- $featured := $images.GetMatch "*feature*" -}} + {{- 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 .Params.hideFeatureImage }}{{ $featured = false }}{{ end }} + {{- with $featured -}} + {{ if or $disableImageOptimization (strings.HasSuffix $featured ".svg")}} + {{ with . }} + <div class="{{ $articleImageClasses }}" style="background-image:url({{ .RelPermalink }});"></div> + {{ end }} + {{ else }} + {{ with .Resize "600x" }} + <div class="{{ $articleImageClasses }}" style="background-image:url({{ .RelPermalink }});"></div> + {{ end }} + {{ end }} + {{- else -}} + {{- with $.Site.Params.images }} + <meta property="og:image" content="{{ index . 0 | absURL }}" />{{ end -}} + {{- end -}} + {{- end -}} + + + <div class="{{ $articleInnerClasses }}"> + <div class="items-center text-left text-xl font-semibold"> + {{ with .Params.externalUrl }} + <div> + <div + class="font-bold text-xl text-neutral-800 decoration-primary-500 hover:underline hover:underline-offset-2 dark:text-neutral"> + {{ $.Title | emojify }} + <span class="text-xs align-top cursor-default text-neutral-400 dark:text-neutral-500"> + <span class="rtl:hidden">↗</span> + <span class="ltr:hidden">↖</span> + </span> + </div> + </div> + {{ else }} + <div class="font-bold text-xl text-neutral-800 decoration-primary-500 hover:underline hover:underline-offset-2 dark:text-neutral" + href="{{ .RelPermalink }}">{{ .Title | emojify }}</div> + {{ end }} + {{ if and .Draft .Site.Params.article.showDraftLabel }} + <div class=" ltr:ml-2 rtl:mr-2"> + {{ partial "badge.html" (i18n "article.draft" | emojify) }} + </div> + {{ end }} + {{ if templates.Exists "partials/extend-article-link.html" }} + {{ partial "extend-article-link.html" . }} + {{ end }} + </div> + <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="py-1 max-w-fit prose dark:prose-invert"> + {{ .Summary | emojify }} + </div> + {{ end }} + </div> + </a>
\ No newline at end of file |