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 -}} - - {{ else -}} - - {{ 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 -}} +