diff --git a/README.md b/README.md index daaffd7..c316f06 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@

-![Doks — Modern Documentation Theme](https://raw.githubusercontent.com/h-enk/doks/master/images/tn.png) +![Doks — Modern Documentation Theme](https://raw.githubusercontent.com/h-enk/doks/master/images/doks.png) ## Demo @@ -156,4 +156,4 @@ Support this project by becoming a sponsor. Your logo will show up here with a l Support this project by becoming a backer. Your avatar will show up here. -[![Backers](https://opencollective.com/doks/tiers/backer.svg)](https://opencollective.com/doks) +[![Backers](https://opencollective.com/doks/tiers/backer.svg?49741992)](https://opencollective.com/doks) diff --git a/archetypes/blog.md b/archetypes/blog.md index b4ad21a..24c911b 100644 --- a/archetypes/blog.md +++ b/archetypes/blog.md @@ -1,11 +1,15 @@ --- title: "{{ replace .Name "-" " " | title }}" description: "" -lead: "" +excerpt: "" date: {{ .Date }} lastmod: {{ .Date }} draft: true weight: 50 -images: ["{{ .Name | urlize }}.jpg"] +images: [] +categories: [] +tags: [] contributors: [] +pinned: false +homepage: false --- diff --git a/assets/images/.gitkeep b/assets/images/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/assets/images/default-image.png b/assets/images/default-image.png new file mode 100644 index 0000000..a34ff9f Binary files /dev/null and b/assets/images/default-image.png differ diff --git a/assets/js/highlight.js b/assets/js/highlight.js index c96b781..4ad6017 100644 --- a/assets/js/highlight.js +++ b/assets/js/highlight.js @@ -7,6 +7,7 @@ import xml from 'highlight.js/lib/languages/xml'; import ini from 'highlight.js/lib/languages/ini'; import yaml from 'highlight.js/lib/languages/yaml'; import markdown from 'highlight.js/lib/languages/markdown'; +import python from 'highlight.js/lib/languages/python'; hljs.registerLanguage('javascript', javascript); hljs.registerLanguage('json', json); @@ -16,6 +17,7 @@ hljs.registerLanguage('ini', ini); hljs.registerLanguage('toml', ini); hljs.registerLanguage('yaml', yaml); hljs.registerLanguage('md', markdown); +hljs.registerLanguage('python', python); document.addEventListener('DOMContentLoaded', () => { document.querySelectorAll('pre code:not(.language-mermaid)').forEach((block) => { diff --git a/assets/js/index.js b/assets/js/index.js index f3d8da1..15e09bb 100644 --- a/assets/js/index.js +++ b/assets/js/index.js @@ -94,7 +94,20 @@ Source: // https://discourse.gohugo.io/t/range-length-or-last-element/3803/2 - {{ $list := (where .Site.Pages "Section" "docs") -}} + {{ $list := slice }} + {{- if and (isset .Site.Params.options "searchsectionsindex") (not (eq (len .Site.Params.options.searchSectionsIndex) 0)) }} + {{- if eq .Site.Params.options.searchSectionsIndex "ALL" }} + {{- $list = .Site.Pages }} + {{- else }} + {{- $list = (where .Site.Pages "Type" "in" .Site.Params.options.searchSectionsIndex) }} + {{- if (in .Site.Params.options.searchSectionsIndex "HomePage") }} + {{ $list = $list | append .Site.Home }} + {{- end }} + {{- end }} + {{- else }} + {{- $list = (where .Site.Pages "Section" "docs") }} + {{- end }} + {{ $len := (len $list) -}} {{ range $index, $element := $list -}} diff --git a/assets/js/to-top.js b/assets/js/to-top.js new file mode 100644 index 0000000..3287f43 --- /dev/null +++ b/assets/js/to-top.js @@ -0,0 +1,20 @@ +var topbutton = document.getElementById('toTop'); + +if (topbutton !== null) { + + topbutton.style.display = 'none'; + window.onscroll = function() { + scrollFunction() + }; + +} + +function scrollFunction() { + + if (document.body.scrollTop > 40 || document.documentElement.scrollTop > 40) { + topbutton.style.display = 'block'; + } else { + topbutton.style.display = 'none'; + } + +} diff --git a/assets/scss/common/_dark.scss b/assets/scss/common/_dark.scss index 2006c2f..cacd363 100644 --- a/assets/scss/common/_dark.scss +++ b/assets/scss/common/_dark.scss @@ -573,4 +573,10 @@ $navbar-dark-active-color: $link-color-dark; [data-dark-mode] #toc a.active { color: $link-color-dark; + +[data-dark-mode] .btn-light { + color: $link-color-dark; + background: $body-overlay-dark; + border: 1px solid $body-overlay-dark; + } diff --git a/assets/scss/common/_global.scss b/assets/scss/common/_global.scss index f95c6ed..475ca6d 100644 --- a/assets/scss/common/_global.scss +++ b/assets/scss/common/_global.scss @@ -4,7 +4,9 @@ .error404 .content, .docs.list .content, .tutorial.list .content, -.showcase.list .content { +.showcase.list .content, +.categories.list .content, +.tags.list .content { padding-top: 1rem; padding-bottom: 3rem; } diff --git a/assets/scss/components/_images.scss b/assets/scss/components/_images.scss index 254eefa..efe3d1c 100644 --- a/assets/scss/components/_images.scss +++ b/assets/scss/components/_images.scss @@ -1,5 +1,19 @@ figure { - margin: 2rem 0; + margin: 0 0 1rem; + display: inline-block; +} + +figure img { + margin-bottom: 0.5rem; + line-height: 1; + max-width: 100%; + height: auto; +} + +figure figcaption { + margin: 0.25rem 0 0.75rem; + font-size: 0.875em; + color: #6c757d; } .figure-caption { diff --git a/assets/scss/layouts/_posts.scss b/assets/scss/layouts/_posts.scss index da27660..27d316a 100644 --- a/assets/scss/layouts/_posts.scss +++ b/assets/scss/layouts/_posts.scss @@ -1,6 +1,9 @@ .home .card, .contributors.list .card, -.blog.list .card { +.blog.list .card, +.blog.single .card, +.categories.list .card, +.tags.list .card { margin-top: 2rem; margin-bottom: 2rem; transition: transform 0.3s; @@ -8,16 +11,34 @@ .home .card:hover, .contributors.list .card:hover, -.blog.list .card:hover { +.blog.list .card:hover, +.blog.single .card:hover, +.categories.list .card:hover, +.tags.list .card:hover { transform: scale(1.025); } +.contributors.list .card.card-terms:hover, +.categories.list .card.card-terms:hover, +.tags.list .card.card-terms:hover { + transform: none; +} + .home .card-body, .contributors.list .card-body, -.blog.list .card-body { +.blog.list .card-body, +.blog.single .card-body, +.categories.list .card-body, +.tags.list .card-body { padding: 0 2rem 1rem; } +.contributors.list .card-terms .card-body, +.categories.list .card-terms .card-body, +.tags.list .card-terms .card-body { + padding: 1rem; +} + .blog-header { text-align: center; margin-bottom: 2rem; @@ -26,3 +47,11 @@ .blog-footer { text-align: center; } + +.related-posts { + margin-top: 4rem; +} + +h2.section-title { + margin-bottom: 1.25rem; +} diff --git a/config/_default/config.toml b/config/_default/config.toml index df71fa9..b6a1f4e 100644 --- a/config/_default/config.toml +++ b/config/_default/config.toml @@ -59,6 +59,8 @@ rel = "sitemap" [taxonomies] contributor = "contributors" + category = "categories" + tag = "tags" [permalinks] blog = "/blog/:title/" @@ -67,6 +69,20 @@ rel = "sitemap" [minify.tdewolff.html] keepWhitespace = false +[related] + threshold = 80 + includeNewer = true + toLower = false + [[related.indices]] + name = "categories" + weight = 100 + [[related.indices]] + name = "tags" + weight = 80 + [[related.indices]] + name = "date" + weight = 10 + [module] [module.hugoVersion] extended = true @@ -78,6 +94,9 @@ rel = "sitemap" [[module.mounts]] source = "static" target = "static" + [[module.mounts]] + source = "layouts" + target = "layouts" [[module.mounts]] source = "node_modules/flexsearch" target = "assets/js/vendor/flexsearch" @@ -87,3 +106,6 @@ rel = "sitemap" [[module.mounts]] source = "node_modules/mermaid" target = "assets/js/vendor/mermaid" + [[module.mounts]] + source = "node_modules/@hyas/images/layouts" + target = "layouts" diff --git a/config/_default/params.toml b/config/_default/params.toml index 8333c72..2c2a2ca 100644 --- a/config/_default/params.toml +++ b/config/_default/params.toml @@ -53,6 +53,17 @@ portraitPhotoWidths = [800, 700, 600, 500] lqipWidth = "20x" smallLimit = "300" +# Images +imageResponsive = true +imageConvertTo = "webp" +imageImageSizes = ["480","720","1080","1280","1600","2048"] +singleSize = false +imageAddClass = "img-fluid lazyload blur-up" + +### Image template +defaultImage = "default-image.png" # put in `./assets/images/` +fillImage = "1270x740 Center" # normalize image size + # Footer footer = "Powered by Netlify, Hugo, and Doks" @@ -83,6 +94,8 @@ lastMod = false clipBoard = true instantPage = true flexSearch = true + searchSectionsShow = [] + searchSectionsIndex = [] darkMode = true bootStrapJs = true breadCrumb = false diff --git a/config/postcss.config.js b/config/postcss.config.js index 3ab38a9..3e0eff8 100644 --- a/config/postcss.config.js +++ b/config/postcss.config.js @@ -23,6 +23,10 @@ module.exports = { 'container-xxl', 'container-fluid', 'offcanvas-backdrop', + 'img-fluid', + 'lazyload', + 'blur-up', + 'figcaption', ...whitelister([ './assets/scss/components/_alerts.scss', './assets/scss/components/_buttons.scss', diff --git a/content/en/blog/say-hello-to-doks/index.md b/content/en/blog/say-hello-to-doks/index.md index e9c3185..d14d357 100644 --- a/content/en/blog/say-hello-to-doks/index.md +++ b/content/en/blog/say-hello-to-doks/index.md @@ -1,11 +1,17 @@ --- title: "Say hello to Doks 👋" description: "Introducing Doks, a Hugo theme helping you build modern documentation websites that are secure, fast, and SEO-ready — by default." -lead: "Introducing Doks, a Hugo theme helping you build modern documentation websites that are secure, fast, and SEO-ready — by default." +excerpt: "Introducing Doks, a Hugo theme helping you build modern documentation websites that are secure, fast, and SEO-ready — by default." date: 2020-11-04T09:19:42+01:00 lastmod: 2020-11-04T09:19:42+01:00 draft: false weight: 50 -images: ["say-hello-to-doks.png"] +images: [] +categories: ["News"] +tags: ["security", "performance", "SEO"] contributors: ["Henk Verlinde"] +pinned: false +homepage: false --- + +Introducing Doks, a Hugo theme helping you build modern documentation websites that are secure, fast, and SEO-ready — by default. diff --git a/content/en/blog/say-hello-to-doks/say-hello-to-doks.png b/content/en/blog/say-hello-to-doks/say-hello-to-doks.png deleted file mode 100644 index 70d8c78..0000000 Binary files a/content/en/blog/say-hello-to-doks/say-hello-to-doks.png and /dev/null differ diff --git a/content/en/docs/help/_index.md b/content/en/docs/help/_index.md index bc503ec..b5763a3 100644 --- a/content/en/docs/help/_index.md +++ b/content/en/docs/help/_index.md @@ -6,4 +6,5 @@ date: 2020-10-06T08:49:15+00:00 lastmod: 2020-10-06T08:49:15+00:00 draft: false images: [] +weight: 600 --- diff --git a/content/en/docs/prologue/_index.md b/content/en/docs/prologue/_index.md index c3c1c40..d6b467c 100644 --- a/content/en/docs/prologue/_index.md +++ b/content/en/docs/prologue/_index.md @@ -6,4 +6,5 @@ date: 2020-10-06T08:48:45+00:00 lastmod: 2020-10-06T08:48:45+00:00 draft: false images: [] +weight: 100 --- diff --git a/images/doks.png b/images/doks.png new file mode 100644 index 0000000..1f5d080 Binary files /dev/null and b/images/doks.png differ diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html deleted file mode 100644 index 4a44740..0000000 --- a/layouts/_default/_markup/render-image.html +++ /dev/null @@ -1,36 +0,0 @@ -{{ $image := "" -}} -{{ if (urls.Parse .Destination).IsAbs }} - {{ $image = resources.GetRemote .Destination -}} -{{ else -}} - {{ $image = .Page.Resources.GetMatch .Destination -}} -{{ end -}} -{{ with $image -}} - {{ $lqip := $image.Resize site.Params.lqipWidth -}} - - {{ $imgSrc := "" -}} - {{ $imgSrcSet := slice -}} - - {{ $widths := site.Params.landscapePhotoWidths -}} - {{ if gt $image.Height $image.Width -}} - {{ $widths = site.Params.portraitPhotoWidths -}} - {{ end -}} - - {{ range $widths -}} - {{ $srcUrl := (printf "%dx" . | $image.Resize).Permalink -}} - {{ if eq $imgSrc "" -}}{{ $imgSrc = $srcUrl -}}{{ end -}} - {{ $imgSrcSet = $imgSrcSet | append (printf "%s %dw" $srcUrl .) -}} - {{ end -}} - {{ $imgSrcSet = (delimit $imgSrcSet ",") -}} - - {{ if gt $image.Width site.Params.smallLimit -}} -
- {{ $.Text }} - - {{ with $.Title }}
{{ . | safeHTML }}
{{ end -}} -
- {{ else -}} - {{ $.Text }} - {{ end -}} -{{ else -}} - {{ erroridf "image-not-found" "Image not found" -}} -{{ end -}} \ No newline at end of file diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index a37c8c2..97d74f6 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -23,5 +23,10 @@ {{ block "sidebar-footer" . }}{{ end }} {{ partial "footer/footer.html" . }} {{ partial "footer/script-footer.html" . }} + {{ if eq .Site.Params.options.toTopButton true -}} +
+ Top +
+ {{ end }} \ No newline at end of file diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 1401ccd..2778b20 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -1,13 +1,32 @@ {{ define "main" }}
-
- {{ range .Paginator.Pages }} - - {{ end }} - {{ template "_internal/pagination.html" . }} +
+

{{ .Title }}

+ {{ with .Content -}}
{{ . }}
{{ end -}} +
+
+
+ {{ $paginator := .Paginate (.Data.Pages) -}} + {{ range $paginator.Pages -}} +
+
+ {{- .Scratch.Set "fillImage" "1270x620 Center" -}} + {{ partial "content/card-image.html" . }} +
+
+

{{ .Params.title }}

+

{{ .Params.excerpt | safeHTML }}

+ {{ partial "main/blog-meta.html" . -}} +
+
+
+
+ {{ end -}} +
+
+
+ {{ $.Scratch.Set "paginator" true }} + {{ template "_internal/pagination.html" . }}
{{ end }} \ No newline at end of file diff --git a/layouts/_default/terms.html b/layouts/_default/terms.html new file mode 100644 index 0000000..73fdeb8 --- /dev/null +++ b/layouts/_default/terms.html @@ -0,0 +1,20 @@ +{{ define "main" }} +
+
+

{{ .Title }}

+
{{ .Content }}
+
+ {{ range .Paginator.Pages }} + + {{ end }} +
+ {{ template "_internal/pagination.html" . }} +
+
+{{ end }} diff --git a/layouts/blog/list.html b/layouts/blog/list.html deleted file mode 100644 index 9695387..0000000 --- a/layouts/blog/list.html +++ /dev/null @@ -1,24 +0,0 @@ -{{ define "main" }} -
-
-
-

{{ .Title }}

-
{{ .Content }}
-
- {{ $paginator := .Paginate (.Data.Pages) -}} - {{ range $paginator.Pages -}} -
-
-

{{ .Params.title }}

-

{{ .Params.lead | safeHTML }}

- {{ partial "main/blog-meta.html" . -}} -
-
- {{ end -}} - {{ $.Scratch.Set "paginator" true }} - {{ template "_internal/pagination.html" . }} -
-
-
-
-{{ end }} \ No newline at end of file diff --git a/layouts/blog/single.html b/layouts/blog/single.html index 48fdb82..178fe31 100644 --- a/layouts/blog/single.html +++ b/layouts/blog/single.html @@ -1,14 +1,59 @@ {{ define "main" }} +
-
-
-
-

{{ .Title }}

- {{ partial "main/blog-meta.html" . }} -
-

{{ .Params.lead | safeHTML }}

- {{ .Content }} -
+
+
+

{{ .Title }}

+ {{ partial "main/blog-meta.html" . }} +
+
+
+
+ {{- .Scratch.Set "fillImage" "1270x715 Center" -}} + {{ partial "content/figure.html" . }} +
+
+
+ {{ .Content }} + {{ if .Params.tags -}} +
+ {{ range $index, $tag := .Params.tags -}} + {{ . }} + {{ end -}} +
+ {{ end -}}
-{{ end }} \ No newline at end of file +
+ +{{ $related := .Site.RegularPages.Related . | first 3 -}} +{{ with $related -}} + +{{ end -}} + +{{ end }} + + diff --git a/layouts/contributors/list.html b/layouts/contributors/list.html deleted file mode 100644 index adc53aa..0000000 --- a/layouts/contributors/list.html +++ /dev/null @@ -1,23 +0,0 @@ -{{ define "main" }} -
-
-
-

{{ .Title }}

-
{{ .Content }}
-
- {{ range .Data.Pages -}} -
-
-

{{ .Params.title }}

- {{ if eq .Section "blog" -}} -

{{ .Params.lead | safeHTML }}

- {{ partial "main/blog-meta.html" . -}} - {{ end -}} -
-
- {{ end -}} -
-
-
-
-{{ end }} \ No newline at end of file diff --git a/layouts/index.headers b/layouts/index.headers index 62a645c..a44c93a 100644 --- a/layouts/index.headers +++ b/layouts/index.headers @@ -2,7 +2,7 @@ Strict-Transport-Security: max-age=31536000; includeSubDomains; preload X-Content-Type-Options: nosniff X-XSS-Protection: 1; mode=block - Content-Security-Policy: default-src 'self'; frame-ancestors https://jamstackthemes.dev; manifest-src 'self' https://*.netlify.app; connect-src 'self' https://*.netlify.app; font-src 'self' https://*.netlify.app; img-src 'self' https://*.netlify.app data:; script-src 'self' https://*.netlify.app 'sha512-RGGByJUOP98hE4wFZM78RM/3MijWJs0Tm0DbfrFhCDCXKXfDx60fii+syp5iMs3UcNX/1H4zJNgmqSejfhHrYw==' 'sha512-RBYr6Ld4w1yVqaACrgrBLQfPgGhj/1jyacA74WxJ1KM6KVcSWymwrdDwb3HDcdpwiNJ5yssot1He0U9vXoQVlg==' 'sha256-aWZ3y/RxbBYKHXH0z8+8ljrHG1mSBvyzSfxSMjBSaXk=' 'sha256-vOgyKS2vkH4n5TxBJpeh9SgzrE6LVGsAeOAvEST6oCc='; style-src 'self' https://*.netlify.app 'unsafe-inline' + Content-Security-Policy: default-src 'self'; frame-ancestors https://jamstackthemes.dev; manifest-src 'self' https://*.netlify.app; connect-src 'self' https://*.netlify.app; font-src 'self' https://*.netlify.app; img-src 'self' https://*.netlify.app data: https://i.giphy.com; script-src 'self' https://*.netlify.app 'sha512-RGGByJUOP98hE4wFZM78RM/3MijWJs0Tm0DbfrFhCDCXKXfDx60fii+syp5iMs3UcNX/1H4zJNgmqSejfhHrYw==' 'sha512-RBYr6Ld4w1yVqaACrgrBLQfPgGhj/1jyacA74WxJ1KM6KVcSWymwrdDwb3HDcdpwiNJ5yssot1He0U9vXoQVlg==' 'sha256-aWZ3y/RxbBYKHXH0z8+8ljrHG1mSBvyzSfxSMjBSaXk=' 'sha256-vOgyKS2vkH4n5TxBJpeh9SgzrE6LVGsAeOAvEST6oCc='; style-src 'self' https://*.netlify.app 'unsafe-inline' X-Frame-Options: SAMEORIGIN Referrer-Policy: strict-origin Feature-Policy: geolocation 'self' diff --git a/layouts/partials/content/card-image.html b/layouts/partials/content/card-image.html new file mode 100644 index 0000000..7a3a43e --- /dev/null +++ b/layouts/partials/content/card-image.html @@ -0,0 +1,22 @@ +{{ $fillImage := .Scratch.Get "fillImageCard" }} +{{ if not $fillImage -}} + {{ $fillImage = site.Params.fillImage }} +{{ end -}} + +{{ $image := .Resources.GetMatch (printf "**%s" (index .Params.images 0)) }} +{{ if not $image -}} + {{ $image = resources.Get (printf "%s%s" "images/" site.Params.defaultImage) }} +{{ end -}} + +{{ $webp := printf "%s%s" $fillImage " webp" }} +{{ $image = $image.Resize $webp}} + +{{ $lqip := $image.Resize site.Params.lqipWidth -}} + +{{ .Title }} diff --git a/layouts/partials/content/figure.html b/layouts/partials/content/figure.html new file mode 100644 index 0000000..fbb0bde --- /dev/null +++ b/layouts/partials/content/figure.html @@ -0,0 +1,37 @@ +{{ $fillImage := .Scratch.Get "fillImage" }} +{{ if not $fillImage -}} + {{ $fillImage = site.Params.fillImage }} +{{ end -}} + +{{ $image := .Resources.GetMatch (printf "**%s" (index .Params.images 0)) }} +{{ if not $image -}} + {{ $image = resources.Get (printf "%s%s" "images/" site.Params.defaultImage) }} +{{ end -}} + +{{ $image = $image.Fill $fillImage }} +{{ $lqip := $image.Resize site.Params.lqipWidth -}} + +{{ $imgSrc := "" -}} +{{ $imgSrcSet := slice -}} + +{{ $widths := site.Params.landscapePhotoWidths -}} +{{ if gt $image.Height $image.Width -}} + {{ $widths = site.Params.portraitPhotoWidths -}} +{{ end -}} + +{{ range $widths -}} + {{ $srcUrl := (printf "%dx" . | $image.Resize).Permalink -}} + {{ if eq $imgSrc "" -}}{{ $imgSrc = $srcUrl -}}{{ end -}} + {{ $imgSrcSet = $imgSrcSet | append (printf "%s %dw" $srcUrl .) -}} +{{ end -}} +{{ $imgSrcSet = (delimit $imgSrcSet ",") -}} + +{{ if gt $image.Width site.Params.smallLimit -}} +
+ {{ .Title }} + + +
+{{ else -}} + {{ .Title }} +{{ end -}} diff --git a/layouts/partials/content/image.html b/layouts/partials/content/image.html new file mode 100644 index 0000000..2772531 --- /dev/null +++ b/layouts/partials/content/image.html @@ -0,0 +1,32 @@ +{{ $image := .Resources.GetMatch (printf "**%s" (index .Params.images 0)) }} +{{ if not $image -}} + {{ $image = resources.Get (printf "%s%s" "images/" site.Params.defaultImage) }} +{{ end -}} + +{{ $image = $image.Fill site.Params.fillImage }} +{{ $lqip := $image.Resize site.Params.lqipWidth -}} + +{{ $imgSrc := "" -}} +{{ $imgSrcSet := slice -}} + +{{ $widths := site.Params.landscapePhotoWidths -}} +{{ if gt $image.Height $image.Width -}} + {{ $widths = site.Params.portraitPhotoWidths -}} +{{ end -}} + +{{ range $widths -}} + {{ $srcUrl := (printf "%dx" . | $image.Resize).Permalink -}} + {{ if eq $imgSrc "" -}}{{ $imgSrc = $srcUrl -}}{{ end -}} + {{ $imgSrcSet = $imgSrcSet | append (printf "%s %dw" $srcUrl .) -}} +{{ end -}} +{{ $imgSrcSet = (delimit $imgSrcSet ",") -}} + +{{ if gt $image.Width site.Params.smallLimit -}} +
+ {{ .Title }} + + +
+{{ else -}} + {{ .Title }} +{{ end -}} diff --git a/layouts/partials/footer/script-footer.html b/layouts/partials/footer/script-footer.html index f57261a..8799730 100644 --- a/layouts/partials/footer/script-footer.html +++ b/layouts/partials/footer/script-footer.html @@ -34,9 +34,14 @@ {{ $slice = $slice | append $instantPage -}} {{ end -}} -{{ if .Site.Params.options.flexSearch -}} +{{ $showFlexSearch := .Site.Params.options.flexSearch }} + +{{ if $showFlexSearch -}} {{ $flexSearch := resources.Get "js/vendor/flexsearch/dist/flexsearch.bundle.js" -}} {{ $slice = $slice | append $flexSearch -}} + {{ if and (isset .Site.Params.options "searchsectionsshow") (not (eq .Site.Params.options.searchSectionsShow "ALL")) -}} + {{ $showFlexSearch = or (eq (len .Site.Params.options.searchSectionsShow) 0) (in .Site.Params.options.searchSectionsShow .Section) (and .IsHome (in .Site.Params.options.searchSectionsShow "HomePage")) -}} + {{ end -}} {{ end -}} {{ if .Site.Params.options.darkMode -}} @@ -60,6 +65,12 @@ {{ $scrollLock := resources.Get "js/scroll-lock.js" | js.Build -}} {{ $slice = $slice | append $scrollLock -}} +{{ if .Site.Params.options.toTopButton -}} + {{ $toTopButton := resources.Get "js/to-top.js" -}} + {{ $toTopButton := $toTopButton | js.Build -}} + {{ $slice = $slice | append $toTopButton -}} +{{ end -}} + {{ $js := $slice | resources.Concat "main.js" -}} {{ if eq (hugo.Environment) "development" -}} @@ -77,7 +88,7 @@ {{ with .Params.mermaid -}} {{ end -}} - {{ if .Site.Params.options.flexSearch -}} + {{ if $showFlexSearch -}} {{ end -}} {{ else -}} @@ -102,7 +113,7 @@ {{ with .Params.mermaid -}} {{ end -}} - {{ if .Site.Params.options.flexSearch -}} + {{ if $showFlexSearch -}} {{ end -}} -{{ end -}} \ No newline at end of file +{{ end -}} diff --git a/layouts/partials/header/header.html b/layouts/partials/header/header.html index 65744ec..93584f4 100644 --- a/layouts/partials/header/header.html +++ b/layouts/partials/header/header.html @@ -53,7 +53,7 @@ {{- $active := or ($current.IsMenuCurrent "main" .) ($current.HasMenuCurrent "main" .) -}} {{- $active = or $active (eq .Name $current.Title) -}} {{- $active = or $active (and (eq .Name ($section | humanize)) (eq $current.Section $section)) -}} - {{- $active = or $active (and (eq .Name "Blog") (eq $current.Section "blog" "contributors")) -}} + {{- $active = or $active (and (eq .Name "Blog") (eq $current.Section "blog" "contributors" "categories" "tags")) -}} {{ if .HasChildren }}