mirror of
https://github.com/nunocoracao/blowfish.git
synced 2026-01-30 16:31:52 +01:00
refactor(list.html): use intermediate variable for complex condition
This commit is contained in:
@@ -9,7 +9,8 @@
|
||||
{{ end }}
|
||||
{{- end -}}
|
||||
|
||||
{{ $toc := and (.Params.showTableOfContents | default (.Site.Params.list.showTableOfContents | default false)) (in .TableOfContents "<ul") }}
|
||||
{{ $enableToc := .Params.showTableOfContents | default (.Site.Params.list.showTableOfContents | default false) }}
|
||||
{{ $showToc := and $enableToc (in .TableOfContents "<ul") }}
|
||||
<header>
|
||||
{{ if .Params.showBreadcrumbs | default (.Site.Params.list.showBreadcrumbs | default false) }}
|
||||
{{ partial "breadcrumbs.html" . }}
|
||||
@@ -35,20 +36,12 @@
|
||||
data-oid-likes="likes_{{ $path }}"></script>
|
||||
{{ end }}
|
||||
</header>
|
||||
<section
|
||||
class="{{ if $toc -}}
|
||||
mt-12
|
||||
{{- else -}}
|
||||
mt-0
|
||||
{{- end }} prose flex max-w-full flex-col dark:prose-invert lg:flex-row">
|
||||
{{ $tocMargin := cond $toc "mt-12" "mt-0" -}}
|
||||
{{ $topClass := cond (hasPrefix .Site.Params.header.layout "fixed") "lg:top-[140px]" "lg:top-10" }}
|
||||
<section class="{{ $tocMargin }} prose flex max-w-full flex-col dark:prose-invert lg:flex-row">
|
||||
{{ if $toc }}
|
||||
<div class="order-first px-0 lg:order-last lg:max-w-xs ltr:lg:pl-8 rtl:lg:pr-8">
|
||||
<div
|
||||
class="toc ltr:pl-5 rtl:pr-5 lg:sticky {{ if hasPrefix .Site.Params.header.layout "fixed" -}}
|
||||
lg:top-[140px]
|
||||
{{ else }}
|
||||
lg:top-10
|
||||
{{ end }}">
|
||||
<div class="toc ltr:pl-5 rtl:pr-5 lg:sticky {{ $topClass }}">
|
||||
{{ partial "toc.html" . }}
|
||||
</div>
|
||||
</div>
|
||||
@@ -94,9 +87,7 @@
|
||||
{{ .Key }}
|
||||
</h2>
|
||||
<section
|
||||
class="w-full grid gap-4 sm:grid-cols-2 md:grid-cols-3 {{ if $cardViewScreenWidth }}
|
||||
xl:grid-cols-4 2xl:grid-cols-5
|
||||
{{ end }}">
|
||||
class="w-full grid gap-4 sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5">
|
||||
{{ range .Pages }}
|
||||
{{ partial "article-link/card.html" . }}
|
||||
{{ end }}
|
||||
@@ -107,9 +98,7 @@
|
||||
{{ .Key }}
|
||||
</h2>
|
||||
<section
|
||||
class="w-full grid gap-4 sm:grid-cols-2 md:grid-cols-3 {{ if $cardViewScreenWidth }}
|
||||
xl:grid-cols-4 2xl:grid-cols-5
|
||||
{{ end }}">
|
||||
class="w-full grid gap-4 sm:grid-cols-2 md:grid-cols-3">
|
||||
{{ range .Pages }}
|
||||
{{ partial "article-link/card.html" . }}
|
||||
{{ end }}
|
||||
|
||||
Reference in New Issue
Block a user