First commit
Some checks failed
Blowfish Docs Deploy / build (push) Has been cancelled
Blowfish Docs Deploy / deploy (push) Has been cancelled
Test Build / Build Example Site (push) Has been cancelled
Mark stale issues and pull requests / stale (push) Has been cancelled
Update Hugo version / updateBlowfish (push) Has been cancelled
Some checks failed
Blowfish Docs Deploy / build (push) Has been cancelled
Blowfish Docs Deploy / deploy (push) Has been cancelled
Test Build / Build Example Site (push) Has been cancelled
Mark stale issues and pull requests / stale (push) Has been cancelled
Update Hugo version / updateBlowfish (push) Has been cancelled
Delete exampleSite Add initial content, images & docker-compose.yml Use extend-head.html for analytics Set remote url to gitea.novicelab.io Remove original .git due to "shallow update not allowed" error
This commit is contained in:
135
layouts/partials/article-link/_shortcode.html
Normal file
135
layouts/partials/article-link/_shortcode.html
Normal file
@@ -0,0 +1,135 @@
|
||||
{{/* Used by
|
||||
1. article shortcode
|
||||
|
||||
The four variants of article-link are very similar. Despite appearances, as of df859f:
|
||||
- _shortcode.html uses $page := $target, while the others use $page := .Page
|
||||
- card-related.html does not have the hideFeatureImage option, while the others do
|
||||
|
||||
$page is added intentionally to prevent small differences inside
|
||||
*/}}
|
||||
{{ $target := .target }}
|
||||
{{ $shortcodeShowSummary := .showSummary }}
|
||||
{{ $shortcodeCompactSummary := .compactSummary }}
|
||||
{{ $constrainItemsWidth := site.Params.list.constrainItemsWidth | default false }}
|
||||
{{ $disableImageOptimization := site.Store.Get "disableImageOptimization" }}
|
||||
|
||||
{{ $cardClasses := "flex flex-col md:flex-row relative" }}
|
||||
{{ $imgWrapperClasses := "" }}
|
||||
{{ $cardContentClasses := "" }}
|
||||
|
||||
{{ if site.Params.list.showCards }}
|
||||
{{ $cardClasses = printf "%s overflow-hidden rounded-lg border border-neutral-300 dark:border-neutral-600" $cardClasses }}
|
||||
{{ $imgWrapperClasses = "" }}
|
||||
{{ $cardContentClasses = printf "%s p-4 pt-2" $cardContentClasses }}
|
||||
{{ else }}
|
||||
{{ $cardClasses = printf "%s" $cardClasses }}
|
||||
{{ $imgWrapperClasses = printf "%s thumbnail-shadow md:mr-7" $imgWrapperClasses }}
|
||||
{{ $cardContentClasses = printf "%s mt-3 md:mt-0" $cardContentClasses }}
|
||||
{{ end }}
|
||||
|
||||
{{ if $constrainItemsWidth }}
|
||||
{{ $cardClasses = printf "%s max-w-prose" $cardClasses }}
|
||||
{{ end }}
|
||||
|
||||
{{ $page := $target }}
|
||||
{{ $featured := "" }}
|
||||
{{ $featuredURL := "" }}
|
||||
{{ if not $target.Params.hideFeatureImage }}
|
||||
{{/* frontmatter */}}
|
||||
{{ with $page }}
|
||||
{{ with .Params.featureimage }}
|
||||
{{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }}
|
||||
{{ if site.Params.hotlinkFeatureImage }}
|
||||
{{ $featuredURL = . }}
|
||||
{{ else }}
|
||||
{{ $featured = resources.GetRemote . }}
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
{{ $featured = resources.Get . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{/* page resources */}}
|
||||
{{ if not (or $featured $featuredURL) }}
|
||||
{{ $images := .Resources.ByType "image" }}
|
||||
{{ range slice "*feature*" "*cover*" "*thumbnail*" }}
|
||||
{{ if not $featured }}{{ $featured = $images.GetMatch . }}{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{/* fallback to default */}}
|
||||
{{ if not (or $featured $featuredURL) }}
|
||||
{{ $default := site.Store.Get "defaultFeaturedImage" }}
|
||||
{{ if $default.url }}
|
||||
{{ $featuredURL = $default.url }}
|
||||
{{ else if $default.obj }}
|
||||
{{ $featured = $default.obj }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{/* generate image URL if not hotlink */}}
|
||||
{{ if not $featuredURL }}
|
||||
{{ with $featured }}
|
||||
{{ $featuredURL = .RelPermalink }}
|
||||
{{ if not (or $disableImageOptimization (eq .MediaType.SubType "svg")) }}
|
||||
{{ $featuredURL = (.Resize "600x").RelPermalink }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
|
||||
<article class="article-link--shortcode {{ $cardClasses }}">
|
||||
{{ with $featuredURL }}
|
||||
<div class="flex-none relative overflow-hidden {{ $imgWrapperClasses }} thumbnail">
|
||||
<img
|
||||
src="{{ . }}"
|
||||
role="presentation"
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
class="not-prose absolute inset-0 w-full h-full object-cover">
|
||||
</div>
|
||||
{{ end }}
|
||||
<div class="{{ $cardContentClasses }}">
|
||||
<header class="items-center text-start text-xl font-semibold">
|
||||
<a
|
||||
{{ with $page.Params.externalUrl }}
|
||||
href="{{ . }}" target="_blank" rel="external"
|
||||
{{ else }}
|
||||
href="{{ $page.RelPermalink }}"
|
||||
{{ end }}
|
||||
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>
|
||||
{{ $target.Title | emojify }}
|
||||
{{ if $target.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 $target.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" $target }}
|
||||
{{ end }}
|
||||
</header>
|
||||
<div class="text-sm text-neutral-500 dark:text-neutral-400">
|
||||
{{ partial "article-meta/basic.html" $target }}
|
||||
</div>
|
||||
{{ if $shortcodeShowSummary | default $target.Params.showSummary | default site.Params.list.showSummary | default false }}
|
||||
{{ $compactSummary := $shortcodeCompactSummary | default $target.Params.compactSummary | default false }}
|
||||
<div
|
||||
class="article-link__summary prose dark:prose-invert max-w-fit mt-1 {{ if $compactSummary -}}
|
||||
line-clamp-3
|
||||
{{- end }}">
|
||||
{{ $target.Summary | plainify }}
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
</article>
|
||||
101
layouts/partials/article-link/card-related.html
Normal file
101
layouts/partials/article-link/card-related.html
Normal file
@@ -0,0 +1,101 @@
|
||||
{{/* Used by
|
||||
1. layouts/partials/related.html (related articles in single page)
|
||||
*/}}
|
||||
{{ $disableImageOptimization := site.Store.Get "disableImageOptimization" }}
|
||||
|
||||
{{ $page := .Page }}
|
||||
{{ $featured := "" }}
|
||||
{{ $featuredURL := "" }}
|
||||
{{/* frontmatter */}}
|
||||
{{ with $page }}
|
||||
{{ with .Params.featureimage }}
|
||||
{{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }}
|
||||
{{ if site.Params.hotlinkFeatureImage }}
|
||||
{{ $featuredURL = . }}
|
||||
{{ else }}
|
||||
{{ $featured = resources.GetRemote . }}
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
{{ $featured = resources.Get . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{/* page resources */}}
|
||||
{{ if not (or $featured $featuredURL) }}
|
||||
{{ $images := .Resources.ByType "image" }}
|
||||
{{ range slice "*feature*" "*cover*" "*thumbnail*" }}
|
||||
{{ if not $featured }}{{ $featured = $images.GetMatch . }}{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{/* fallback to default */}}
|
||||
{{ if not (or $featured $featuredURL) }}
|
||||
{{ $default := site.Store.Get "defaultFeaturedImage" }}
|
||||
{{ if $default.url }}
|
||||
{{ $featuredURL = $default.url }}
|
||||
{{ else if $default.obj }}
|
||||
{{ $featured = $default.obj }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{/* generate image URL if not hotlink */}}
|
||||
{{ if not $featuredURL }}
|
||||
{{ with $featured }}
|
||||
{{ $featuredURL = .RelPermalink }}
|
||||
{{ if not (or $disableImageOptimization (eq .MediaType.SubType "svg")) }}
|
||||
{{ $featuredURL = (.Resize "600x").RelPermalink }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
|
||||
<article
|
||||
class="article-link--related relative min-h-full min-w-full overflow-hidden rounded-lg border border-neutral-300 dark:border-neutral-600">
|
||||
{{ with $featuredURL }}
|
||||
<div class="flex-none relative overflow-hidden thumbnail_card_related">
|
||||
<img
|
||||
src="{{ . }}"
|
||||
role="presentation"
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
fetchpriority="low"
|
||||
class="not-prose absolute inset-0 w-full h-full object-cover">
|
||||
</div>
|
||||
{{ 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="p-4">
|
||||
<header>
|
||||
<a
|
||||
{{ with $page.Params.externalUrl }}
|
||||
href="{{ . }}" target="_blank" rel="external"
|
||||
{{ else }}
|
||||
href="{{ $page.RelPermalink }}"
|
||||
{{ end }}
|
||||
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>
|
||||
</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="article-link__summary prose dark:prose-invert mt-1 line-clamp-5">
|
||||
{{ .Summary | plainify }}
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
<div class="px-6 pt-4 pb-2"></div>
|
||||
</article>
|
||||
104
layouts/partials/article-link/card.html
Normal file
104
layouts/partials/article-link/card.html
Normal file
@@ -0,0 +1,104 @@
|
||||
{{/* Used by
|
||||
1. list.html and term.html (when the cardView option is enabled)
|
||||
2. Recent articles template (when the cardView option is enabled)
|
||||
3. Shortcode list.html
|
||||
*/}}
|
||||
{{ $disableImageOptimization := site.Store.Get "disableImageOptimization" }}
|
||||
|
||||
{{ $page := .Page }}
|
||||
{{ $featured := "" }}
|
||||
{{ $featuredURL := "" }}
|
||||
{{ if not .Params.hideFeatureImage }}
|
||||
{{/* frontmatter */}}
|
||||
{{ with $page }}
|
||||
{{ with .Params.featureimage }}
|
||||
{{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }}
|
||||
{{ if site.Params.hotlinkFeatureImage }}
|
||||
{{ $featuredURL = . }}
|
||||
{{ else }}
|
||||
{{ $featured = resources.GetRemote . }}
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
{{ $featured = resources.Get . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{/* page resources */}}
|
||||
{{ if not (or $featured $featuredURL) }}
|
||||
{{ $images := .Resources.ByType "image" }}
|
||||
{{ range slice "*feature*" "*cover*" "*thumbnail*" }}
|
||||
{{ if not $featured }}{{ $featured = $images.GetMatch . }}{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{/* fallback to default */}}
|
||||
{{ if not (or $featured $featuredURL) }}
|
||||
{{ $default := site.Store.Get "defaultFeaturedImage" }}
|
||||
{{ if $default.url }}
|
||||
{{ $featuredURL = $default.url }}
|
||||
{{ else if $default.obj }}
|
||||
{{ $featured = $default.obj }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{/* generate image URL if not hotlink */}}
|
||||
{{ if not $featuredURL }}
|
||||
{{ with $featured }}
|
||||
{{ $featuredURL = .RelPermalink }}
|
||||
{{ if not (or $disableImageOptimization (eq .MediaType.SubType "svg")) }}
|
||||
{{ $featuredURL = (.Resize "600x").RelPermalink }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
|
||||
<article
|
||||
class="article-link--card relative min-h-full min-w-full overflow-hidden rounded-lg border border-neutral-300 dark:border-neutral-600">
|
||||
{{ with $featuredURL }}
|
||||
<div class="flex-none relative overflow-hidden thumbnail_card">
|
||||
<img
|
||||
src="{{ . }}"
|
||||
role="presentation"
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
class="not-prose absolute inset-0 w-full h-full object-cover">
|
||||
</div>
|
||||
{{ 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="p-4">
|
||||
<header>
|
||||
<a
|
||||
{{ with $page.Params.externalUrl }}
|
||||
href="{{ . }}" target="_blank" rel="external"
|
||||
{{ else }}
|
||||
href="{{ $page.RelPermalink }}"
|
||||
{{ end }}
|
||||
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>
|
||||
</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="article-link__summary prose dark:prose-invert mt-1 line-clamp-5">
|
||||
{{ .Summary | plainify }}
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
<div class="px-6 pt-4 pb-2"></div>
|
||||
</article>
|
||||
123
layouts/partials/article-link/simple.html
Normal file
123
layouts/partials/article-link/simple.html
Normal file
@@ -0,0 +1,123 @@
|
||||
{{/* 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 := site.Params.list.constrainItemsWidth | default false }}
|
||||
{{ $disableImageOptimization := site.Store.Get "disableImageOptimization" }}
|
||||
|
||||
{{ $cardClasses := "flex flex-col md:flex-row relative" }}
|
||||
{{ $imgWrapperClasses := "" }}
|
||||
{{ $cardContentClasses := "" }}
|
||||
|
||||
{{ if .Params.showCards | default site.Params.list.showCards }}
|
||||
{{ $cardClasses = printf "%s overflow-hidden rounded-lg border border-neutral-300 dark:border-neutral-600" $cardClasses }}
|
||||
{{ $imgWrapperClasses = "" }}
|
||||
{{ $cardContentClasses = printf "%s p-4" $cardContentClasses }}
|
||||
{{ else }}
|
||||
{{ $cardClasses = $cardClasses }}
|
||||
{{ $imgWrapperClasses = printf "%s thumbnail-shadow md:mr-7" $imgWrapperClasses }}
|
||||
{{ $cardContentClasses = printf "%s mt-3 md:mt-0" $cardContentClasses }}
|
||||
{{ end }}
|
||||
|
||||
{{ if $constrainItemsWidth }}
|
||||
{{ $cardClasses = printf "%s max-w-prose" $cardClasses }}
|
||||
{{ end }}
|
||||
|
||||
{{ $page := .Page }}
|
||||
{{ $featured := "" }}
|
||||
{{ $featuredURL := "" }}
|
||||
{{ if not .Params.hideFeatureImage }}
|
||||
{{/* frontmatter */}}
|
||||
{{ with $page }}
|
||||
{{ with .Params.featureimage }}
|
||||
{{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }}
|
||||
{{ if site.Params.hotlinkFeatureImage }}
|
||||
{{ $featuredURL = . }}
|
||||
{{ else }}
|
||||
{{ $featured = resources.GetRemote . }}
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
{{ $featured = resources.Get . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{/* page resources */}}
|
||||
{{ if not (or $featured $featuredURL) }}
|
||||
{{ $images := .Resources.ByType "image" }}
|
||||
{{ range slice "*feature*" "*cover*" "*thumbnail*" }}
|
||||
{{ if not $featured }}{{ $featured = $images.GetMatch . }}{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{/* fallback to default */}}
|
||||
{{ if not (or $featured $featuredURL) }}
|
||||
{{ $default := site.Store.Get "defaultFeaturedImage" }}
|
||||
{{ if $default.url }}
|
||||
{{ $featuredURL = $default.url }}
|
||||
{{ else if $default.obj }}
|
||||
{{ $featured = $default.obj }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{/* generate image URL if not hotlink */}}
|
||||
{{ if not $featuredURL }}
|
||||
{{ with $featured }}
|
||||
{{ $featuredURL = .RelPermalink }}
|
||||
{{ if not (or $disableImageOptimization (eq .MediaType.SubType "svg")) }}
|
||||
{{ $featuredURL = (.Resize "600x").RelPermalink }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
|
||||
<article class="article-link--simple {{ $cardClasses }}">
|
||||
{{ with $featuredURL }}
|
||||
<div class="flex-none relative overflow-hidden {{ $imgWrapperClasses }} thumbnail">
|
||||
<img
|
||||
src="{{ . }}"
|
||||
role="presentation"
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
class="not-prose absolute inset-0 w-full h-full object-cover">
|
||||
</div>
|
||||
{{ end }}
|
||||
<div class="{{ $cardContentClasses }}">
|
||||
<header class="items-center text-start text-xl font-semibold">
|
||||
<a
|
||||
{{ with $page.Params.externalUrl }}
|
||||
href="{{ . }}" target="_blank" rel="external"
|
||||
{{ else }}
|
||||
href="{{ $page.RelPermalink }}"
|
||||
{{ end }}
|
||||
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="article-link__summary prose dark:prose-invert max-w-fit mt-1 line-clamp-3">
|
||||
{{ .Summary | plainify }}
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
<div class="px-6 pt-4 pb-2"></div>
|
||||
</article>
|
||||
Reference in New Issue
Block a user