59 lines
2.6 KiB
HTML
59 lines
2.6 KiB
HTML
{{ define "body-class" }}article-page keep-sidebar links-page{{ end }}
|
|
{{ define "main" }}
|
|
{{ $linksTitle := default .Title .Params.linksTitle }}
|
|
<section class="links-section" aria-labelledby="links-title">
|
|
<header class="links-section__header">
|
|
<h1 id="links-title">{{ $linksTitle }}</h1>
|
|
</header>
|
|
|
|
<div class="links-grid">
|
|
{{ $siteResources := resources }}
|
|
{{ range $link := hugo.Data.links }}
|
|
{{ $enabled := not (eq $link.enabled false) }}
|
|
<article class="link-card{{ if not $enabled }} link-card--disabled{{ end }}">
|
|
{{ if $enabled }}
|
|
<a class="link-card__body" href="{{ $link.website }}" target="_blank" rel="noopener">
|
|
{{ else }}
|
|
<div class="link-card__body" aria-disabled="true">
|
|
{{ end }}
|
|
<div class="link-card__details">
|
|
<h2 class="link-card__title">
|
|
<span class="link-card__name">{{ $link.title }}</span>
|
|
{{ if not $enabled }}
|
|
<span class="link-card__status">已失效</span>
|
|
{{ end }}
|
|
</h2>
|
|
<p class="link-card__description">
|
|
{{ with $link.description }}
|
|
{{ . }}
|
|
{{ else }}
|
|
{{ $link.website }}
|
|
{{ end }}
|
|
</p>
|
|
</div>
|
|
|
|
{{ if $link.image }}
|
|
{{ $image := $siteResources.Get (delimit (slice "link-img/" $link.image) "") | resources.Fingerprint "md5" }}
|
|
{{ $imageResized := $image.Resize "120x120" }}
|
|
<div class="link-card__image">
|
|
<img src="{{ $imageResized.RelPermalink }}" width="{{ $imageResized.Width }}" height="{{ $imageResized.Height }}"
|
|
loading="lazy" alt="{{ $link.title }}" data-key="links-{{ $link.website }}" data-hash="{{ $image.Data.Integrity }}">
|
|
</div>
|
|
{{ end }}
|
|
{{ if $enabled }}</a>{{ else }}</div>{{ end }}
|
|
</article>
|
|
{{ end }}
|
|
</div>
|
|
</section>
|
|
|
|
{{ partial "article/article.html" . }}
|
|
|
|
{{ if or (not (isset .Params "comments")) (eq .Params.comments "true")}}
|
|
{{ partial "comments/include" . }}
|
|
{{ end }}
|
|
|
|
{{ partialCached "footer/footer" . }}
|
|
|
|
{{ partialCached "article/components/photoswipe" . }}
|
|
{{ end }}
|