diff --git a/layouts/_default/list.html b/layouts/_default/list.html index a5010d8..1551596 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -3,37 +3,36 @@ - +
{{ partial "knowledge-graph.html" . }}
- +
{{ .Content }}
{{ range .Pages }} - {{ $page := . }}

{{ .LinkTitle }}

- + - + {{ with .Description }}
{{ . }}
{{ end }} - + {{ with .Summary }}
{{ . }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 397702e..3fc7fcd 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -4,7 +4,7 @@ {{ if and .Params.toc .TableOfContents }}
- + {{ with .Params.image }} {{ $imagePath := . }} + {{ $imageRes := resources.Get $imagePath }} {{ $imageExists := false }} - {{ with resources.Get $imagePath }} + {{ $imgWidth := 0 }} + {{ $imgHeight := 0 }} + {{ with $imageRes }} {{ $imageExists = true }} + {{ if .MediaType }} + {{ if hasPrefix .MediaType.MainType "image" }} + {{ $imgWidth = .Width }} + {{ $imgHeight = .Height }} + {{ end }} + {{ end }} {{ else }} {{ with fileExists (printf "static/%s" $imagePath) }} {{ $imageExists = true }} {{ end }} {{ end }} - + {{ if $imageExists }}
{{ $altText := $.Params.alt | default $.Title }} - {{ $altText }} + {{ $altText }}
{{ $altText }}
{{ end }} {{ end }} - + - +
{{ .Content }}
- + - + {{ if ne .Params.comments false }} - {{ if .Site.Params.comments.remark42.enabled }} + {{ if site.Params.comments.remark42.enabled }} {{ partial "comments/remark42.html" . }} {{ end }} {{ end }} @@ -162,119 +160,7 @@

{{ .Title }}

- -{{ $scripts := slice }} -{{ $styles := slice }} - - -{{ with resources.Get "css/tooltip.css" }} - {{ $styles = $styles | append . }} -{{ end }} - - -{{ with resources.Get "css/references.css" }} - {{ $styles = $styles | append . }} -{{ end }} - -{{ $sidenotesJS := resources.Get "js/sidenotes.js" }} -{{ $referencesJS := resources.Get "js/references.js" }} -{{ $scripts = $scripts | append $sidenotesJS $referencesJS }} - - -{{ with resources.Get "css/single.css" }} - {{ $styles = $styles | append . }} -{{ end }} - - -{{ if and .Params.toc .TableOfContents }} - {{ $tocJS := resources.Get "js/toc.js" }} - {{ $scripts = $scripts | append $tocJS }} -{{ end }} - - -{{ $tooltipJS := resources.Get "js/tooltip.js" }} -{{ $scripts = $scripts | append $tooltipJS }} - - -{{ $tableWrapperJS := resources.Get "js/table-wrapper.js" }} -{{ $scripts = $scripts | append $tableWrapperJS }} - - -{{ $bibtexJS := resources.Get "js/bibtex.js" }} -{{ $scripts = $scripts | append $bibtexJS }} - - -{{ with resources.Get "css/components/pdf-button.css" }} - {{ $styles = $styles | append . }} -{{ end }} - - -{{ with resources.Get "css/components/tts-button.css" }} - {{ $styles = $styles | append . }} -{{ end }} - -{{ $pdfJS := resources.Get "js/pdf-generator.js" }} -{{ $ttsJS := resources.Get "js/tts.js" }} -{{ if $pdfJS }} - {{ $scripts = $scripts | append $pdfJS }} -{{ else }} - {{ warnf "PDF generator script not found: js/pdf-generator.js" }} -{{ end }} -{{ if site.Params.enableHDVoice }} - {{ with resources.Get "js/piper-tts.js" }} - {{ $scripts = $scripts | append . }} - {{ end }} -{{ end }} -{{ if $ttsJS }} - {{ $scripts = $scripts | append $ttsJS }} -{{ else }} - {{ warnf "TTS script not found: js/tts.js" }} -{{ end }} - - -{{ with resources.Get "css/components/pdf-print.css" }} - {{ $styles = $styles | append . }} -{{ end }} - - -{{ with resources.Get "css/components/copy-button.css" }} - {{ $styles = $styles | append . }} -{{ end }} - - -{{ $copyButtonJS := resources.Get "js/copy-button.js" }} -{{ $scripts = $scripts | append $copyButtonJS }} - - - -{{ if gt (len $scripts) 0 }} - {{ $combinedScripts := $scripts | resources.Concat "js/single-page.js" | minify | fingerprint }} - -{{ else }} - {{ warnf "No scripts to bundle on single page" }} -{{ end }} - -{{ with site.Params.pdf }} - -{{ end }} - - -{{ if gt (len $styles) 0 }} - {{ $combinedStyles := $styles | resources.Concat "css/single-page.css" | resources.Minify | fingerprint }} - -{{ end }} +{{ partial "print-vars.html" . }} {{ end }} diff --git a/layouts/partials/icons.html b/layouts/partials/icons.html new file mode 100644 index 0000000..5887c0d --- /dev/null +++ b/layouts/partials/icons.html @@ -0,0 +1,67 @@ +{{- /* + layouts/partials/icons.html + + Reusable SVG icon library for PKB-theme. Centralizes inline SVGs that were + previously scattered across single.html, header.html, footer.html, etc. + + Usage: + {{ partial "icons.html" (dict "name" "calendar") }} + {{ partial "icons.html" (dict "name" "calendar" "class" "meta-icon") }} + {{ partial "icons.html" (dict "name" "github" "size" 20) }} + + Args (passed via dict): + name (string, required) - icon identifier (calendar, clock, share, ...) + class (string, optional) - CSS class on the ; defaults to "icon" + size (int, optional) - pixel width/height; defaults vary per icon + + Available icons: + calendar, clock, share, edit, github, twitter, linkedin, instagram, + orcid, email, rss, x-close, search, menu, sun, moon, user, folder, + tag, copy +*/ -}} +{{- $name := .name | default "" -}} +{{- $class := .class | default "icon" -}} +{{- $size := .size | default 16 -}} +{{- if eq $name "calendar" -}} + +{{- else if eq $name "clock" -}} + +{{- else if eq $name "user" -}} + +{{- else if eq $name "folder" -}} + +{{- else if eq $name "tag" -}} + +{{- else if eq $name "share" -}} + +{{- else if eq $name "edit" -}} + +{{- else if eq $name "github" -}} + +{{- else if eq $name "twitter" -}} + +{{- else if eq $name "linkedin" -}} + +{{- else if eq $name "instagram" -}} + +{{- else if eq $name "orcid" -}} + +{{- else if eq $name "email" -}} + +{{- else if eq $name "rss" -}} + +{{- else if eq $name "x-close" -}} + +{{- else if eq $name "search" -}} + +{{- else if eq $name "menu" -}} + +{{- else if eq $name "sun" -}} + +{{- else if eq $name "moon" -}} + +{{- else if eq $name "copy" -}} + +{{- else -}} +{{- warnf "icons.html: unknown icon name %q" $name -}} +{{- end -}} diff --git a/layouts/partials/print-vars.html b/layouts/partials/print-vars.html new file mode 100644 index 0000000..3104c28 --- /dev/null +++ b/layouts/partials/print-vars.html @@ -0,0 +1,23 @@ +{{- /* + layouts/partials/print-vars.html + + Emits an inline