diff --git a/.prettierignore b/.prettierignore index 0a829920..d26f8b34 100644 --- a/.prettierignore +++ b/.prettierignore @@ -27,7 +27,6 @@ static layouts/_default/_markup/render-heading.html layouts/_default/index.json -layouts/_default/list.html layouts/shortcodes/screenshot.html layouts/shortcodes/figure.html layouts/partials/hugo-embedded/shortcodes/figure-default.html diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 0b71d2ce..b746f93e 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -1,14 +1,14 @@ + data-default-appearance="{{ site.Params.defaultAppearance | default " light" }}" + data-auto-appearance="{{ site.Params.autoSwitchAppearance | default " true" }}"> {{- partial "head.html" . -}} @@ -17,13 +17,12 @@
{{ i18n - "nav.skip_to_main" - }} + href="#main-content"> + + {{ i18n "nav.skip_to_main" }} +
- {{ $header := print "header/" .Site.Params.header.layout ".html" }} + {{ $header := print "header/" site.Params.header.layout ".html" }} {{ if templates.Exists ( printf "partials/%s" $header ) }} {{ partial $header . }} {{ else }} @@ -32,26 +31,26 @@
{{ block "main" . }}{{ end }} - {{ if and (.Site.Params.footer.showScrollToTop | default true) (gt .WordCount 1) }} + {{ if and (site.Params.footer.showScrollToTop | default true) (gt .WordCount 1) }} {{- partial "scroll-to-top.html" . -}} {{ end }}
{{- partial "footer.html" . -}} - {{ if .Site.Params.enableSearch | default false }} + {{ if site.Params.enableSearch | default false }} {{- partial "search.html" . -}} {{ end }}
- {{ if .Site.Params.buymeacoffee.globalWidget | default false }} + {{ if site.Params.buymeacoffee.globalWidget | default false }} {{ end }} diff --git a/layouts/_default/list.html b/layouts/_default/list.html index db52acd1..10d78f1a 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -1,139 +1,157 @@ {{ define "main" }} + {{ .Scratch.Set "scope" "list" }} + {{ $enableToc := .Params.showTableOfContents | default (site.Params.list.showTableOfContents | default false) }} + {{ $showToc := and $enableToc (in .TableOfContents " - {{ if .Params.showBreadcrumbs | default (.Site.Params.list.showBreadcrumbs | default false) }} - {{ partial "breadcrumbs.html" . }} - {{ end }} -

{{ .Title }}

-
- {{ partial "article-meta/list.html" (dict "context" . "scope" "single") }} -
- {{ $translations := .AllTranslations }} - {{ with .File }} - {{ $path := .Path }} - {{range $translations}} - {{ $lang := print "." .Lang ".md" }} - {{ $path = replace $path $lang ".md" }} - {{end}} - {{ $jsPage := resources.Get "js/page.js" }} - {{ $jsPage = $jsPage | resources.Minify | resources.Fingerprint ($.Site.Params.fingerprintAlgorithm | default "sha512") }} - - {{ end }} - -
- {{ if $toc }} -
-
- {{ partial "toc.html" . }} -
+ {{/* Header */}} +
+ {{ if .Params.showBreadcrumbs | default (site.Params.list.showBreadcrumbs | default false) }} + {{ partial "breadcrumbs.html" . }} + {{ end }} +

{{ .Title }}

+
+ {{ partial "article-meta/list.html" (dict "context" . "scope" "single") }}
+ {{ $translations := .AllTranslations }} + {{ with .File }} + {{ $path := .Path }} + {{ range $translations }} + {{ $lang := print "." .Lang ".md" }} + {{ $path = replace $path $lang ".md" }} + {{ end }} + {{ $jsPage := resources.Get "js/page.js" }} + {{ $jsPage = $jsPage | resources.Minify | resources.Fingerprint (site.Params.fingerprintAlgorithm | default "sha512") }} + + {{ end }} +
+ + {{/* Description (markdown content) */}} + {{ $tocMargin := cond $showToc "mt-12" "mt-0" }} + {{ $topClass := cond (hasPrefix site.Params.header.layout "fixed") "lg:top-[140px]" "lg:top-10" }} +
+ {{ if $showToc }} +
+
+ {{ partial "toc.html" . }} +
+
{{ end }}
{{ .Content }}
- - - -
- {{ if gt .Pages 0 }} - {{ $cardView := .Params.cardView | default (.Site.Params.list.cardView | default false) }} - {{ $cardViewScreenWidth := .Params.cardViewScreenWidth | default (.Site.Params.list.cardViewScreenWidth | default false) }} - {{ $groupByYear := .Params.groupByYear | default ($.Site.Params.list.groupByYear | default false) }} - {{ $orderByWeight := .Params.orderByWeight | default ($.Site.Params.list.orderByWeight | default false) }} + {{/* Article Grid */}} + {{ if gt .Pages 0 }} + {{ $cardView := .Params.cardView | default (site.Params.list.cardView | default false) }} + {{ $cardViewScreenWidth := .Params.cardViewScreenWidth | default (site.Params.list.cardViewScreenWidth | default false) }} + {{ $groupByYear := .Params.groupByYear | default (site.Params.list.groupByYear | default false) }} + {{ $orderByWeight := .Params.orderByWeight | default (site.Params.list.orderByWeight | default false) }} {{ $groupByYear := and (not $orderByWeight) $groupByYear }} {{ if not $cardView }} - -
- {{ if not $orderByWeight }} - {{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }} - {{ if $groupByYear }} -

- {{ .Key }} -

- {{ end }} - {{ range .Pages }} - {{ partial "article-link/simple.html" . }} - {{ end }} - {{ end }} - {{ else }} - {{ range (.Paginate (.Pages.ByWeight)).Pages }} - {{ partial "article-link/simple.html" . }} - {{ end }} - {{ end }} -
- - {{ else }} - - {{ if $groupByYear }} - - {{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }} - {{ if $cardViewScreenWidth }} -
- {{ end }} -

- {{ .Key }} -

-
- {{ range .Pages }} - {{ partial "article-link/card.html" . }} - {{ end }} -
- {{ if $cardViewScreenWidth }}
{{ end }} - {{ end }} - - {{ else }} - - {{ if $cardViewScreenWidth }} -
-
- {{ else }} -
- {{ end }} +
{{ if not $orderByWeight }} {{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }} - {{ range .Pages }} - {{ partial "article-link/card.html" . }} - {{ end }} + {{ if $groupByYear }} +

+ {{ .Key }} +

+ {{ end }} + {{ range .Pages }} + {{ partial "article-link/simple.html" . }} + {{ end }} {{ end }} {{ else }} {{ range (.Paginate (.Pages.ByWeight)).Pages }} - {{ partial "article-link/card.html" . }} + {{ partial "article-link/simple.html" . }} + {{ end }} + {{ end }} +
+ {{/* else: is cardView */}} + {{ else }} + {{ if $groupByYear }} + {{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }} + {{ if $cardViewScreenWidth }} +
+

+ {{ .Key }} +

+
+ {{ range .Pages }} + {{ partial "article-link/card.html" . }} + {{ end }} +
+
+ {{ else }} +

+ {{ .Key }} +

+
+ {{ range .Pages }} + {{ partial "article-link/card.html" . }} + {{ end }} +
{{ end }} {{ end }} -
- {{ if $cardViewScreenWidth }}
{{ end }} - - {{ end }} - - {{end}} + {{/* else: not groupByYear */}} + {{ else }} + {{ if $cardViewScreenWidth }} +
+
+ {{ if not $orderByWeight }} + {{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }} + {{ range .Pages }} + {{ partial "article-link/card.html" . }} + {{ end }} + {{ end }} + {{ else }} + {{ range (.Paginate (.Pages.ByWeight)).Pages }} + {{ partial "article-link/card.html" . }} + {{ end }} + {{ end }} +
+
+ {{ else }} +
+ {{ if not $orderByWeight }} + {{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }} + {{ range .Pages }} + {{ partial "article-link/card.html" . }} + {{ end }} + {{ end }} + {{ else }} + {{ range (.Paginate (.Pages.ByWeight)).Pages }} + {{ partial "article-link/card.html" . }} + {{ end }} + {{ end }} +
+ {{ end }}{{/* End of cardViewScreenWidth */}} + {{ end }}{{/* End of groupByYear */}} + {{ end }}{{/* End of cardView */}} + {{/* else: .Pages not greater to zero */}} {{ else }} -
-

- {{ i18n "list.no_articles" | emojify }} -

-
- {{ end }} - - {{ partial "pagination.html" . }} - +
+

+ {{ i18n "list.no_articles" | emojify }} +

+
{{ end }} + {{ partial "pagination.html" . }} +{{ end }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index d9378bb2..6d1f9c1f 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,11 +1,10 @@ {{ define "main" }} {{ .Scratch.Set "scope" "single" }} - -
- {{ if .Params.showHero | default (.Site.Params.article.showHero | default false) }} + {{/* Hero */}} + {{ if .Params.showHero | default (site.Params.article.showHero | default false) }} {{ $heroStyle := .Params.heroStyle }} - {{ if not $heroStyle }}{{ $heroStyle = .Site.Params.article.heroStyle }}{{ end }} + {{ if not $heroStyle }}{{ $heroStyle = site.Params.article.heroStyle }}{{ end }} {{ $heroStyle := print "hero/" $heroStyle ".html" }} {{ if templates.Exists ( printf "partials/%s" $heroStyle ) }} {{ partial $heroStyle . }} @@ -14,9 +13,9 @@ {{ end }} {{ end }} - + {{/* Header */}}
- {{ if .Params.showBreadcrumbs | default (.Site.Params.article.showBreadcrumbs | default false) }} + {{ if .Params.showBreadcrumbs | default (site.Params.article.showBreadcrumbs | default false) }} {{ partial "breadcrumbs.html" . }} {{ end }}

@@ -25,73 +24,24 @@
{{ partial "article-meta/basic.html" (dict "context" . "scope" "single") }}
- - {{ $authorsData := .Site.Data.authors }} - {{ $taxonomies := .Site.Taxonomies.authors }} - {{ $baseURL := .Site.BaseURL }} - {{ $taxonomyLink := 0 }} - {{ $showAuthor := 0 }} - - {{ if not (strings.HasSuffix $baseURL "/") }} - {{ $baseURL = delimit (slice $baseURL "/") "" }} + {{ if not (.Params.showAuthorBottom | default (site.Params.article.showAuthorBottom | default false)) }} + {{ template "SingleAuthor" . }} {{ end }} - - {{ if not (.Params.showAuthorBottom | default ( .Site.Params.article.showAuthorBottom | default false)) }} - - {{ if .Params.showAuthor | default (.Site.Params.article.showAuthor | default true) }} - {{ $showAuthor = 1 }} - {{ partial "author.html" . }} - {{ end }} - - {{ range $author := .Page.Params.authors }} - {{ $authorData := index $authorsData $author }} - {{- if $authorData -}} - {{ range $taxonomyname, $taxonomy := $taxonomies }} - {{ if (eq $taxonomyname $author) }} - {{ $taxonomyLink = delimit (slice $baseURL "authors/" $author "/") "" }} - {{ end }} - {{ end }} - - {{ $finalLink := $taxonomyLink }} - {{ $currentLang := $.Site.Language.Lang }} - {{ if eq $.Site.LanguagePrefix "" }} - {{ $finalLink = printf "%sauthors/%s/" $baseURL $author }} - {{ else }} - {{ $finalLink = printf "%s%s/authors/%s/" $baseURL $currentLang $author }} - {{ end }} - - {{ partial "author-extra.html" (dict "context" . "data" $authorData "link" $finalLink) }} - {{- end -}} - {{ end }} - - {{ if or $taxonomyLink $showAuthor }} -
- {{ end }} - - {{ end }} -

+ {{/* Body */}}
- {{ if or (and (.Params.showTableOfContents | default (.Site.Params.article.showTableOfContents | default false)) (in - .TableOfContents " -
- {{ if and (.Params.showTableOfContents | default (.Site.Params.article.showTableOfContents | default false)) (in - .TableOfContents " + {{ if $showToc }} {{ partial "toc.html" . }} {{ end }} - {{ if .Site.Params.article.showRelatedPosts | - default false - }} + {{ if $showRelated }} sd {{ end }}
@@ -101,49 +51,24 @@
{{ partial "series/series.html" . }} - -
{{ .Content }} - {{ $defaultReplyByEmail := .Site.Params.replyByEmail }} + {{ $defaultReplyByEmail := site.Params.replyByEmail }} {{ $replyByEmail := default $defaultReplyByEmail .Params.replyByEmail }} {{ if $replyByEmail }} + href="mailto:{{ site.Params.Author.email }}?subject={{ replace (printf "Reply to %s" .Title) "\"" "'" }}"> Reply by Email {{ end }}
- - {{ if (.Params.showAuthorBottom | default ( .Site.Params.article.showAuthorBottom | default false)) }} - - {{ if .Params.showAuthor | default (.Site.Params.article.showAuthor | default true) }} - {{ $showAuthor = 1 }} - {{ partial "author.html" . }} - {{ end }} - - {{ range $author := .Page.Params.authors }} - {{ $authorData := index $authorsData $author }} - {{- if $authorData -}} - {{ range $taxonomyname, $taxonomy := $taxonomies }} - {{ if (eq $taxonomyname $author) }} - {{ $taxonomyLink = delimit (slice $baseURL "authors/" $author "/") "" }} - {{ end }} - {{ end }} - {{ partial "author-extra.html" (dict "context" . "data" $authorData "link" $taxonomyLink) }} - {{- end -}} - {{ end }} - - {{ if or $taxonomyLink $showAuthor }} -
- {{ end }} - + {{ if (.Params.showAuthorBottom | default (site.Params.article.showAuthorBottom | default false)) }} + {{ template "SingleAuthor" . }} {{ end }} - {{ partial "series/series-closed.html" . }} {{ partial "sharing-links.html" . }} {{ partial "related.html" . }} @@ -157,7 +82,7 @@ {{ $path = replace $path $lang ".md" }} {{ end }} {{ $jsPage := resources.Get "js/page.js" }} - {{ $jsPage = $jsPage | resources.Minify | resources.Fingerprint ($.Site.Params.fingerprintAlgorithm | default "sha512") }} + {{ $jsPage = $jsPage | resources.Minify | resources.Fingerprint (site.Params.fingerprintAlgorithm | default "sha512") }} {{ end }} -
+ + {{/* Footer */}}
{{ partial "article-pagination.html" . }} - {{ if .Params.showComments | default (.Site.Params.article.showComments | default false) }} + {{ if .Params.showComments | default (site.Params.article.showComments | default false) }} {{ if templates.Exists "partials/comments.html" }}

@@ -184,3 +110,45 @@
{{ end }} + +{{ define "SingleAuthor" }} + {{ $authorsData := site.Data.authors }} + {{ $taxonomies := site.Taxonomies.authors }} + {{ $baseURL := site.BaseURL }} + {{ $taxonomyLink := 0 }} + {{ $showAuthor := 0 }} + {{ $isAuthorBottom := (.Params.showAuthorBottom | default ( site.Params.article.showAuthorBottom | default false)) }} + + {{ if not (strings.HasSuffix $baseURL "/") }} + {{ $baseURL = delimit (slice $baseURL "/") "" }} + {{ end }} + + {{ if .Params.showAuthor | default (site.Params.article.showAuthor | default true) }} + {{ $showAuthor = 1 }} + {{ partial "author.html" . }} + {{ end }} + + {{ range $author := .Page.Params.authors }} + {{ $authorData := index $authorsData $author }} + {{- if $authorData -}} + {{ range $taxonomyname, $taxonomy := $taxonomies }} + {{ if (eq $taxonomyname $author) }} + {{ $taxonomyLink = delimit (slice $baseURL "authors/" $author "/") "" }} + {{ end }} + {{ end }} + + {{ $finalLink := $taxonomyLink }} + {{ $currentLang := site.Language.Lang }} + {{ if eq site.LanguagePrefix "" }} + {{ $finalLink = printf "%sauthors/%s/" $baseURL $author }} + {{ else }} + {{ $finalLink = printf "%s%s/authors/%s/" $baseURL $currentLang $author }} + {{ end }} + {{ partial "author-extra.html" (dict "context" . "data" $authorData "link" $finalLink) }} + {{- end -}} + {{ end }} + + {{ if or $taxonomyLink $showAuthor }} +
+ {{ end }} +{{ end }} diff --git a/layouts/_default/term.html b/layouts/_default/term.html index 4da61336..3506a66e 100644 --- a/layouts/_default/term.html +++ b/layouts/_default/term.html @@ -1,7 +1,7 @@ {{ define "main" }} {{ .Scratch.Set "scope" "term" }} - {{ if .Site.Params.term.showHero | default false }} - {{ $heroStyle := print "hero/" .Site.Params.term.heroStyle ".html" }} + {{ if site.Params.term.showHero | default false }} + {{ $heroStyle := print "hero/" site.Params.term.heroStyle ".html" }} {{ if templates.Exists ( printf "partials/%s" $heroStyle ) }} {{ partial $heroStyle . }} {{ else }} @@ -9,11 +9,9 @@ {{ end }} {{- end -}} - {{ $toc := and (.Params.showTableOfContents | default (.Site.Params.term.showTableOfContents | default false)) (in - .TableOfContents " - {{ if .Params.showBreadcrumbs | default (.Site.Params.term.showBreadcrumbs | default false) }} + {{ if .Params.showBreadcrumbs | default (site.Params.term.showBreadcrumbs | default false) }} {{ partial "breadcrumbs.html" . }} {{ end }}

{{ .Title }}

@@ -28,7 +26,7 @@ {{ .Content }}
{{ $jsPage := resources.Get "js/page.js" }} - {{ $jsPage = $jsPage | resources.Minify | resources.Fingerprint (.Site.Params.fingerprintAlgorithm | default "sha512") }} + {{ $jsPage = $jsPage | resources.Minify | resources.Fingerprint (site.Params.fingerprintAlgorithm | default "sha512") }} {{ end }} - {{ if .Site.Params.taxonomy.cardView }} + {{ if site.Params.taxonomy.cardView }}
{{ range .Data.Terms }} {{ partial "term-link/card.html" . }}