diff --git a/.github/workflows/node.js-ci.yml b/.github/workflows/node.js-ci.yml index fce41fc..72ec081 100644 --- a/.github/workflows/node.js-ci.yml +++ b/.github/workflows/node.js-ci.yml @@ -1,13 +1,10 @@ -# Test and build your Hyas project -# For more information see: https://henkverlinde.com/continuous-integration-workflow-for-your-hyas-project/ - name: Hyas CI on: push: - branches: [master] + branches: master pull_request: - branches: [master] + branches: master jobs: build: @@ -16,33 +13,22 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest, macos-latest] - node-version: [14.x, 15.x] + node: [14.x, 16.x] steps: - - uses: actions/checkout@v2 + - name: Check out Hyas project + uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 + - name: Set up Node.js ${{ matrix.node }} + uses: actions/setup-node@v2 with: - node-version: ${{ matrix.node-version }} - - - name: Install Hugo - uses: peaceiris/actions-hugo@v2 - with: - hugo-version: 'latest' - extended: true - - - name: Check install Hugo - run: hugo version + node-version: ${{ matrix.node }} - name: Install dependencies run: npm ci - - - name: Check for linting errors + + - name: Run Hyas test script run: npm test - - - name: Delete temporary directories - run: npm run clean - + - name: Build production website - run: npm run build + run: npm run build \ No newline at end of file diff --git a/.github/workflows/readme.yml b/.github/workflows/readme.yml deleted file mode 100644 index 9b40ec7..0000000 --- a/.github/workflows/readme.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: Readme - -on: - schedule: - - cron: 0 18 * * * - push: - branches: - - master - -jobs: - update: - runs-on: ubuntu-latest - steps: - - uses: JasonEtco/rss-to-readme@v1 - with: - feed-url: https://getdoks.org/blog/index.xml - readme-section: feed \ No newline at end of file diff --git a/.gitignore b/.gitignore index 6b84644..a4f7c60 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ -functions +bin node_modules public resources # Local Netlify folder -.netlify \ No newline at end of file +.netlify +TODO \ No newline at end of file diff --git a/.npmrc b/.npmrc deleted file mode 100644 index 445772b..0000000 --- a/.npmrc +++ /dev/null @@ -1 +0,0 @@ -hugo_bin_build_tags = "extended" \ No newline at end of file diff --git a/.versionrc.json b/.versionrc.json deleted file mode 100644 index 61f45fa..0000000 --- a/.versionrc.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "types": [ - {"type": "feat", "section": "Features"}, - {"type": "fix", "section": "Bug Fixes"}, - {"type": "chore", "hidden": true}, - {"type": "deps", "section": "Dependencies"}, - {"type": "docs", "section": "Documentation"}, - {"type": "style", "hidden": true}, - {"type": "refactor", "hidden": true}, - {"type": "perf", "hidden": true}, - {"type": "test", "hidden": true} - ], - "bumpFiles": [ - { - "filename": "package.json", - "type": "json" - }, - { - "filename": "package-lock.json", - "type": "json" - }, - { - "filename": "data/doks.json", - "type": "json" - } - ] -} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e64ad5..3d918e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,145 @@ -# Changelog +### Changelog -All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +All notable changes to this project will be documented in this file. Dates are displayed in UTC. + +Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). + +#### [v0.3.3](https://github.com/h-enk/doks/compare/v0.3.2...v0.3.3) + +- Add Mermaid support [`#369`](https://github.com/h-enk/doks/pull/369) +- Fix lint tests on Linux. [`#373`](https://github.com/h-enk/doks/pull/373) +- feat: add mermaid [`f1fa5c5`](https://github.com/h-enk/doks/commit/f1fa5c5936558ff0b62d8a150bf303629bf50840) +- content: remove temporary mermaid examples [`e4fc868`](https://github.com/h-enk/doks/commit/e4fc8681623685bf20f8e6568a69b5b6c4d81d16) +- fix: update package-lock.json [`3797685`](https://github.com/h-enk/doks/commit/379768538d584676d40c99432f8b49f20c2c0562) + +#### [v0.3.2](https://github.com/h-enk/doks/compare/v0.3.1...v0.3.2) + +> 5 July 2021 + +- feat: update netlify workflow [`692efd6`](https://github.com/h-enk/doks/commit/692efd66692173a651c4b91d2ff3bc5f584a8a31) + +#### [v0.3.1](https://github.com/h-enk/doks/compare/v0.3.0...v0.3.1) + +> 2 July 2021 + +- fix: update theme.toml [`a0d4a76`](https://github.com/h-enk/doks/commit/a0d4a76d2a8187eae70b394905889a37e14b7a47) +- fix: update permalinks setting [`4894d96`](https://github.com/h-enk/doks/commit/4894d96a69eb2c70b7059c90ee02594286b1122e) + +#### [v0.3.0](https://github.com/h-enk/doks/compare/v0.2.3...v0.3.0) + +> 25 June 2021 + +- ✨ Adds video shortcode [`#244`](https://github.com/h-enk/doks/pull/244) +- ✨ Adds collapsible sidebar as an option [`#243`](https://github.com/h-enk/doks/pull/243) +- 🐛 Fixes scrollbar in code blocks [`#231`](https://github.com/h-enk/doks/pull/231) +- fix: add crossorigin attribute to webmanifest link [`#306`](https://github.com/h-enk/doks/pull/306) +- ✨ Uses inline shortcode in alerts for large texts [`#235`](https://github.com/h-enk/doks/pull/235) +- Fix issue where page bundle images fail to load [`#238`](https://github.com/h-enk/doks/pull/238) +- Replace highlightBlock with highlightElement [`#240`](https://github.com/h-enk/doks/pull/240) +- replaces possible backslash for win environments [`#217`](https://github.com/h-enk/doks/pull/217) +- feat: add hugo-installer + auto-changelog [`93f7598`](https://github.com/h-enk/doks/commit/93f7598f872509805287b24d7d06fa3e6f745fbf) +- deps: bump versions to latest [`33ccb71`](https://github.com/h-enk/doks/commit/33ccb717cb4b2fe859e79df36597cfa01cad08a9) +- deps: bump versions to latest [`7b2bea1`](https://github.com/h-enk/doks/commit/7b2bea1bff290389b2a098d13100e1c4dfa3a4d5) + +#### [v0.2.3](https://github.com/h-enk/doks/compare/v0.2.2...v0.2.3) + +> 2 April 2021 + +- feat: update for netlify dev support [`10d0b45`](https://github.com/h-enk/doks/commit/10d0b45203003a43727521dc9f5c35e655500309) +- content: update for doks v0.2.3 [`b505b24`](https://github.com/h-enk/doks/commit/b505b2412bc59fa271f7bf33ca6c835f66ca2936) +- content: update readme [`52cd0c6`](https://github.com/h-enk/doks/commit/52cd0c6e6c902381c5775d5c719c5cdf1ff64111) + +#### [v0.2.2](https://github.com/h-enk/doks/compare/v0.2.1...v0.2.2) + +> 26 March 2021 + +- deps: bump bootstrap to 5.0.0-beta3 [`f76e68e`](https://github.com/h-enk/doks/commit/f76e68e832737c5fbc2421f164988767dddc5d99) +- feat: update default highlight style [`28a3b39`](https://github.com/h-enk/doks/commit/28a3b39fb9653db3f627cd55d610f28ed95860b3) +- chore(release): 0.2.2 [`c332b4d`](https://github.com/h-enk/doks/commit/c332b4d315431da4d94e98f0c2e6649fea0c8219) + +#### [v0.2.1](https://github.com/h-enk/doks/compare/v0.2.0...v0.2.1) + +> 18 March 2021 + +- chore(release): 0.2.1 [`41f9d0e`](https://github.com/h-enk/doks/commit/41f9d0ee49077b3440c119eaf6c5d955f56127f2) +- fix: update package.json for npm workflow [`83b2c0e`](https://github.com/h-enk/doks/commit/83b2c0e002e09aabc0f4b1e8fb30353151707d8b) +- Updating the README! [`d36a6cc`](https://github.com/h-enk/doks/commit/d36a6ccaa8a99aa022cca641eb4d4d6f126ef8a4) + +#### [v0.2.0](https://github.com/h-enk/doks/compare/v0.1.6...v0.2.0) + +> 18 March 2021 + +- Add katex math typesetting [`#181`](https://github.com/h-enk/doks/pull/181) +- Add highlight.js as an option [`#180`](https://github.com/h-enk/doks/pull/180) +- Add optional breadcrumb trail [`#166`](https://github.com/h-enk/doks/pull/166) +- Add table support in markdown [`#165`](https://github.com/h-enk/doks/pull/165) +- Update bootstrap to 5.0.0-beta2 [`#164`](https://github.com/h-enk/doks/pull/164) +- chore(release): 0.2.0 [`c80a5da`](https://github.com/h-enk/doks/commit/c80a5dab1dead3108011793a0777dc6d94a47d70) +- ux: improve contrast text searchbar dark mode [`57fee17`](https://github.com/h-enk/doks/commit/57fee179f8b8ee0c45d90456703230e1e7edeb84) +- Updating the README! [`884d44e`](https://github.com/h-enk/doks/commit/884d44e0f7e3187a6431b8bdf8501993a6f80ac8) + +#### [v0.1.6](https://github.com/h-enk/doks/compare/v0.1.5...v0.1.6) + +> 1 March 2021 + +- build(deps-dev): bump postcss from 8.2.4 to 8.2.6 [`#132`](https://github.com/h-enk/doks/pull/132) +- deps: bump versions to latest [`857906c`](https://github.com/h-enk/doks/commit/857906c69b2d9779abd158dd88c1057f84c8eb6f) +- chore(release): 0.1.6 [`a83f039`](https://github.com/h-enk/doks/commit/a83f0392638c0c8fb775187a4b251c106921cef9) +- scripts: add release:dry-run script [`686d0eb`](https://github.com/h-enk/doks/commit/686d0eb40da535c6907cf97c1d5c9353a1535b8c) + +#### [v0.1.5](https://github.com/h-enk/doks/compare/v0.1.4...v0.1.5) + +> 12 January 2021 + +- chore(release): 0.1.5 [`ff85a1d`](https://github.com/h-enk/doks/commit/ff85a1daecfff2aa21ddbc425c8d67b5e4cd6d9b) +- Updating the README! [`d50ed1e`](https://github.com/h-enk/doks/commit/d50ed1ec0f37d178e1aef133d280b91d5473cd14) +- feat: add hugo extended as a dependency [`258224c`](https://github.com/h-enk/doks/commit/258224c7880911c709f80e478cacf265fafbbb5c) + +#### [v0.1.4](https://github.com/h-enk/doks/compare/v0.1.3...v0.1.4) + +> 3 December 2020 + +- deps: bump versions to latest [`7ce56d0`](https://github.com/h-enk/doks/commit/7ce56d0a362c5099c0a6c50f6ad0f1c7ba969218) +- deps: bump versions to latest [`0377b0d`](https://github.com/h-enk/doks/commit/0377b0de75a3cc8027bd255961f6d0c184d82575) +- deps: bump versions [`c254be6`](https://github.com/h-enk/doks/commit/c254be61754071600665858d6a7d2e2fbc105af3) + +#### [v0.1.3](https://github.com/h-enk/doks/compare/v0.1.2...v0.1.3) + +> 17 November 2020 + +- chore(release): 0.1.3 [`abaaaef`](https://github.com/h-enk/doks/commit/abaaaef6d6056133737d285868e8f8c748b6cc46) +- deps: update doks version file [`d326669`](https://github.com/h-enk/doks/commit/d326669c1d170cd5a76df1faafea472f3132fdf5) +- deps: add doks version file [`f8dcfbe`](https://github.com/h-enk/doks/commit/f8dcfbeebfda5fef533b9b7bc2463fa0dfafd5fa) + +#### [v0.1.2](https://github.com/h-enk/doks/compare/v0.1.1...v0.1.2) + +> 17 November 2020 + +- deps: bump versions [`6ce5813`](https://github.com/h-enk/doks/commit/6ce5813543417f2328846a78b971201d7611781d) +- style: update fonts+ [`41d63a2`](https://github.com/h-enk/doks/commit/41d63a2528f574e3934d58fb30811ce9fb879798) +- chore(release): 0.1.2 [`646f0c8`](https://github.com/h-enk/doks/commit/646f0c87f0ee5a9a97d357753e86647519f3d1ed) + +#### [v0.1.1](https://github.com/h-enk/doks/compare/v0.1.0...v0.1.1) + +> 10 November 2020 + +- deps: reinstall [`6705f4b`](https://github.com/h-enk/doks/commit/6705f4bbc4da4cd967e7165ab3681137014633bb) +- docs: update content [`c4c83eb`](https://github.com/h-enk/doks/commit/c4c83eb9b68674553c6a7e988249a808d75250b4) +- docs: update reasons [`1cec423`](https://github.com/h-enk/doks/commit/1cec4237b395ff306b765d47b29b8410c2884921) + +#### v0.1.0 + +> 6 November 2020 + +- build(deps-dev): bump postcss from 8.1.4 to 8.1.6 [`#18`](https://github.com/h-enk/doks/pull/18) +- Bump lodash from 4.17.15 to 4.17.20 [`#8`](https://github.com/h-enk/doks/pull/8) +- [Security] Bump elliptic from 6.5.2 to 6.5.3 [`#6`](https://github.com/h-enk/doks/pull/6) +- [Security] Bump lazysizes from 5.2.0 to 5.2.1 [`#7`](https://github.com/h-enk/doks/pull/7) +- test: update ci [`d16a94d`](https://github.com/h-enk/doks/commit/d16a94db755deff04e56da96f4e84d339a094236) +- deps: bump postcss [`12411c3`](https://github.com/h-enk/doks/commit/12411c38a98fb362ff348e5c151fcb7813e8691e) +- Initial commit [`67f0a6e`](https://github.com/h-enk/doks/commit/67f0a6e623169a99a71c51c2434e14041c9211aa) + + ### [0.2.3](https://github.com/h-enk/doks/compare/v0.2.2...v0.2.3) (2021-04-02) diff --git a/LICENSE b/LICENSE index fc33812..a9431aa 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,7 @@ MIT License -Copyright (c) 2020-2021 Gridsome, Henk Verlinde +Copyright (c) 2018-present, Gridsome +Copyright (c) 2020-present, Henk Verlinde Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -18,4 +19,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file +SOFTWARE. diff --git a/README.md b/README.md index 4a89be7..6cf137d 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ GitHub Workflow Status (branch) - Netlify + Netlify

@@ -117,9 +117,3 @@ Doks comes with [commands](https://getdoks.org/docs/prologue/commands/) for comm - [Netlify Community](https://community.netlify.com/) - [Hugo Forums](https://discourse.gohugo.io/) - [Doks Discussions](https://github.com/h-enk/doks/discussions) - -## Blog - -* [Doks v0.2](https://getdoks.org/blog/doks-v0.2/) -* [Say hello to Doks 👋](https://getdoks.org/blog/say-hello-to-doks/) - diff --git a/assets/js/clipboard.js b/assets/js/clipboard.js index b216c12..55eec7b 100644 --- a/assets/js/clipboard.js +++ b/assets/js/clipboard.js @@ -1,8 +1,27 @@ import Clipboard from 'clipboard'; -var clipboard = new Clipboard('.btn-clipboard'); +var pre = document.getElementsByTagName('pre'); + +for (var i = 0; i < pre.length; ++ i) +{ + var element = pre[i]; + var mermaid = element.getElementsByClassName('language-mermaid')[0]; + + if (mermaid == null) { + element.insertAdjacentHTML('afterbegin', ''); + } +} + +var clipboard = new Clipboard('.btn-copy', { + + target: function(trigger) { + return trigger.nextElementSibling; + }, + +}); clipboard.on('success', function(e) { + /* console.info('Action:', e.action); console.info('Text:', e.text); diff --git a/assets/js/highlight.js b/assets/js/highlight.js index f9879dc..c96b781 100644 --- a/assets/js/highlight.js +++ b/assets/js/highlight.js @@ -3,7 +3,7 @@ import hljs from 'highlight.js/lib/core'; import javascript from 'highlight.js/lib/languages/javascript'; import json from 'highlight.js/lib/languages/json'; import bash from 'highlight.js/lib/languages/bash'; -import htmlbars from 'highlight.js/lib/languages/htmlbars'; +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'; @@ -11,14 +11,14 @@ import markdown from 'highlight.js/lib/languages/markdown'; hljs.registerLanguage('javascript', javascript); hljs.registerLanguage('json', json); hljs.registerLanguage('bash', bash); -hljs.registerLanguage('html', htmlbars); +hljs.registerLanguage('html', xml); hljs.registerLanguage('ini', ini); hljs.registerLanguage('toml', ini); hljs.registerLanguage('yaml', yaml); hljs.registerLanguage('md', markdown); document.addEventListener('DOMContentLoaded', () => { - document.querySelectorAll('pre code').forEach((block) => { + document.querySelectorAll('pre code:not(.language-mermaid)').forEach((block) => { hljs.highlightElement(block); }); }); diff --git a/assets/js/index.js b/assets/js/index.js index 8c87d5f..0df2fd2 100644 --- a/assets/js/index.js +++ b/assets/js/index.js @@ -64,37 +64,54 @@ Source: (function(){ - var index = new FlexSearch({ - preset: 'score', - cache: true, - doc: { - id: 'id', - field: [ - 'title', - 'description', - 'content', - ], - store: [ - 'href', - 'title', - 'description', - ], - }, + var index = new FlexSearch.Document({ + tokenize: "forward", + cache: 100, + document: { + id: 'id', + store: [ + "href", "title", "description" + ], + index: ["title", "description", "content"] + } }); + + // Not yet supported: https://github.com/nextapps-de/flexsearch#complex-documents + + /* var docs = [ {{ range $index, $page := (where .Site.Pages "Section" "docs") -}} { id: {{ $index }}, - href: "{{ .RelPermalink | relURL }}", + href: "{{ .Permalink }}", title: {{ .Title | jsonify }}, description: {{ .Params.description | jsonify }}, content: {{ .Content | jsonify }} }, {{ end -}} ]; + */ - index.add(docs); + // https://discourse.gohugo.io/t/range-length-or-last-element/3803/2 + + {{ $list := (where .Site.Pages "Section" "docs") -}} + {{ $len := (len $list) -}} + + index.add( + {{ range $index, $element := $list -}} + { + id: {{ $index }}, + href: "{{ .Permalink }}", + title: {{ .Title | jsonify }}, + description: {{ .Params.description | jsonify }}, + content: {{ .Content | jsonify }} + }) + {{ if ne (add $index 1) $len -}} + .add( + {{ end -}} + {{ end -}} + ; userinput.addEventListener('input', show_results, true); suggestions.addEventListener('click', accept_suggestion, true); @@ -102,13 +119,13 @@ Source: function show_results(){ var value = this.value; - var results = index.search(value, 5); + var results = index.search(value, { limit: 5, index: ["content"], enrich: true }); var entry, childs = suggestions.childNodes; var i = 0, len = results.length; suggestions.classList.remove('d-none'); - results.forEach(function(page) { + results.forEach(function(results) { entry = document.createElement('div'); @@ -118,9 +135,11 @@ Source: t = entry.querySelector('span:first-child'), d = entry.querySelector('span:nth-child(2)'); - a.href = page.href; - t.textContent = page.title; - d.textContent = page.description; + // console.log(results); + + a.href = results.result[i].doc.href; + t.textContent = results.result[i].doc.title; + d.textContent = results.result[i].doc.description; suggestions.appendChild(entry); diff --git a/assets/js/mermaid.js b/assets/js/mermaid.js new file mode 100644 index 0000000..2ab0b9a --- /dev/null +++ b/assets/js/mermaid.js @@ -0,0 +1,11 @@ +import mermaid from 'mermaid/dist/mermaid'; + +var config = { + theme: 'default', + fontFamily: '"Jost", -apple-system, blinkmacsystemfont, "Segoe UI", roboto, "Helvetica Neue", arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";', +}; + +document.addEventListener('DOMContentLoaded', () => { + mermaid.initialize(config); + mermaid.init(undefined, '.language-mermaid'); +}); diff --git a/assets/lambda/.gitignore b/assets/lambda/.gitignore deleted file mode 100644 index e69de29..0000000 diff --git a/assets/scss/app.scss b/assets/scss/app.scss index 29a22a5..fc76d8e 100644 --- a/assets/scss/app.scss +++ b/assets/scss/app.scss @@ -8,7 +8,7 @@ @import "bootstrap/scss/bootstrap"; /** Import highlight.js */ -// @import "highlight.js/scss/dracula"; +// @import "highlight.js/scss/github-dark-dimmed"; /** Import KaTeX */ @import "katex/dist/katex"; @@ -17,14 +17,14 @@ @import "common/fonts"; @import "common/global"; @import "common/dark"; -@import "components/doks"; -// @import "components/syntax"; -@import "components/code"; @import "components/alerts"; @import "components/buttons"; +@import "components/code"; +@import "components/syntax"; @import "components/comments"; @import "components/forms"; @import "components/images"; +@import "components/mermaid"; @import "components/search"; @import "components/tables"; @import "layouts/footer"; diff --git a/assets/scss/common/_dark.scss b/assets/scss/common/_dark.scss index 0789939..479dfc1 100644 --- a/assets/scss/common/_dark.scss +++ b/assets/scss/common/_dark.scss @@ -98,6 +98,10 @@ body.dark .page-links a { color: $body-color-dark; } +body.dark .btn-toggle-nav a { + color: $body-color-dark; +} + body.dark .showcase-meta a { color: $body-color-dark; } @@ -114,6 +118,43 @@ body.dark .page-links a:hover { color: $link-color-dark; } +body.dark .btn-toggle { + color: $body-color-dark; + background-color: transparent; + border: 0; +} + +body.dark .btn-toggle:hover, +body.dark .btn-toggle:focus { + color: $body-color-dark; +} + +body.dark .btn-toggle::before { + width: 1.25em; + line-height: 0; + content: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='rgba%28222, 226, 230, 0.75%29' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M5 14l6-6-6-6'/%3e%3c/svg%3e"); + transition: transform 0.35s ease; + transform-origin: 0.5em 50%; + margin-bottom: 0.125rem; +} + +body.dark .btn-toggle[aria-expanded="true"] { + color: $body-color-dark; +} + +body.dark .btn-toggle[aria-expanded="true"]::before { + transform: rotate(90deg); +} + +body.dark .btn-toggle-nav a:hover, +body.dark .btn-toggle-nav a:focus { + color: $link-color-dark; +} + +body.dark .btn-toggle-nav a.active { + color: $link-color-dark; +} + body.dark .navbar-light .navbar-text a { color: $navbar-dark-active-color; } @@ -188,12 +229,7 @@ body.dark .docs-navigation { } body.dark pre code::-webkit-scrollbar-thumb { - background: $border-dark; -} - -body.dark code:not(.hljs) { - background: $body-overlay-dark; - color: $body-color-dark; + background: $gray-400; } body.dark pre code:hover { @@ -202,7 +238,17 @@ body.dark pre code:hover { } body.dark pre code::-webkit-scrollbar-thumb:hover { - background: $border-dark; + background: $gray-500; +} + +body.dark code:not(.hljs):not(.language-mermaid) { + background: $body-overlay-dark; + color: $body-color-dark; +} + +body.dark .mermaid, +body.dark pre code.language-mermaid { + background: $white; } body.dark blockquote { diff --git a/assets/scss/common/_variables.scss b/assets/scss/common/_variables.scss index 4bb8fc4..eab8191 100644 --- a/assets/scss/common/_variables.scss +++ b/assets/scss/common/_variables.scss @@ -24,6 +24,10 @@ $pink-500: #d32e9d; $primary: $purple; +$color-btn-bg: $pink-500; +$color-btn-border: darken($pink-500, 5%); +$color-btn-text: $white; + // Options // // Quickly modify global styling by enabling or disabling optional features. diff --git a/assets/scss/components/_alerts.scss b/assets/scss/components/_alerts.scss index b40c571..ae6fbf7 100644 --- a/assets/scss/components/_alerts.scss +++ b/assets/scss/components/_alerts.scss @@ -61,3 +61,9 @@ .alert .alert-link:focus { text-decoration: none; } + +.alert code { + background: darken($beige, 5%); + color: $black; + padding: 0.25rem 0.5rem; +} diff --git a/assets/scss/components/_buttons.scss b/assets/scss/components/_buttons.scss index f20a0d2..713f819 100644 --- a/assets/scss/components/_buttons.scss +++ b/assets/scss/components/_buttons.scss @@ -50,42 +50,136 @@ body.dark .toggle-dark { display: none; } -.btn-clipboard { - display: none; +pre { + position: relative; +} + +@include media-breakpoint-down(md) { + .btn-copy { + display: none; + } +} + +.btn-copy { + transition: opacity 0.3s ease-in-out; + opacity: 0; + position: absolute; + right: 0.25rem; + top: 0.25rem; + z-index: 10; + font-family: $font-family-sans-serif; + font-size: $font-size-sm; + padding: 0.25rem 0.5rem; + color: $color-btn-text; + background-color: $color-btn-bg; + border-color: $color-btn-border; +} + +.btn-copy:hover { + color: $color-btn-text; + background-color: lighten($color-btn-bg, 5%); + border-color: lighten($color-btn-border, 15%); +} + +.btn-copy:focus { + color: $color-btn-text; + background-color: $color-btn-bg; + border-color: lighten($color-btn-border, 15%); + box-shadow: none; +} + +.btn-copy:active, +.btn-copy.active { + color: $color-btn-text; + background-color: $color-btn-bg; + border-color: lighten($color-btn-border, 15%); +} + +.btn-copy:active:focus, +.btn-copy.active:focus { + box-shadow: none; } @include media-breakpoint-up(md) { - .doks-clipboard { - position: relative; - float: right; - } - - .btn-clipboard { - position: absolute; - top: 1rem; - right: 0.25rem; - z-index: 10; - display: block; - padding: 0.25rem 0.5rem; - font-size: $font-size-sm; + pre:hover .btn-copy { + opacity: 1; } } -.copy-status::after { +.btn-copy::after { content: "Copy"; display: block; + color: $color-btn-text; +} + +.btn-copy:hover::after { + content: "Copy"; + display: block; + color: $color-btn-text; +} + +.btn-copy:focus::after, +.btn-copy:active::after { + content: "Copied"; + display: block; + color: $color-btn-text; +} + +.collapsible-sidebar { + margin: 2.125rem 0; +} + +.btn-toggle { + display: inline-flex; + align-items: center; + padding: 0.25rem 0.5rem 0.25rem 0; + font-weight: $headings-font-weight; + font-size: $font-size-base; + text-transform: uppercase; + color: $body-color; + background-color: transparent; + border: 0; +} + +.btn-toggle:hover, +.btn-toggle:focus { + color: $body-color; + background-color: transparent; + outline: 0; + box-shadow: none; +} + +.btn-toggle::before { + width: 1.25em; + line-height: 0; + content: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='rgba%2829, 45, 53, 0.75%29' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M5 14l6-6-6-6'/%3e%3c/svg%3e"); + transition: transform 0.35s ease; + transform-origin: 0.5em 50%; + margin-bottom: 0.125rem; +} + +.btn-toggle[aria-expanded="true"] { color: $body-color; } -.copy-status:hover::after { - content: "Copy"; - display: block; - color: $pink-500; +.btn-toggle[aria-expanded="true"]::before { + transform: rotate(90deg); } -.copy-status:focus::after, -.copy-status:active::after { - content: "Copied"; - display: block; - color: $pink-500; +.btn-toggle-nav a { + display: inline-flex; + padding: 0.1875rem 0.5rem; + margin-top: 0.125rem; + margin-left: 1.25rem; + text-decoration: none; +} + +.btn-toggle-nav a:hover, +.btn-toggle-nav a:focus { + background-color: transparent; + color: $link-color; +} + +.btn-toggle-nav a.active { + color: $link-color; } diff --git a/assets/scss/components/_code.scss b/assets/scss/components/_code.scss index 9ad855b..eb0c0a0 100644 --- a/assets/scss/components/_code.scss +++ b/assets/scss/components/_code.scss @@ -49,14 +49,18 @@ pre code::-webkit-scrollbar { } pre code::-webkit-scrollbar-thumb { - background: $gray-200; + background: $gray-400; } pre code:hover { scrollbar-width: thin; - scrollbar-color: $gray-200 transparent; + scrollbar-color: $gray-500 transparent; } pre code::-webkit-scrollbar-thumb:hover { - background: $gray-200; + background: $gray-500; +} + +code.language-mermaid { + background: none; } diff --git a/assets/scss/components/_doks.scss b/assets/scss/components/_doks.scss deleted file mode 100644 index 4c8bfc7..0000000 --- a/assets/scss/components/_doks.scss +++ /dev/null @@ -1,62 +0,0 @@ -/* - -Doks — based on Ascetic by (c) Ivan Sagalaev - -*/ - -.hljs { - display: block; - overflow-x: auto; - padding: 0.5em; - background: $beige; - color: $body-color; -} - -.hljs-string, -.hljs-variable, -.hljs-template-variable, -.hljs-symbol, -.hljs-bullet, -.hljs-section, -.hljs-addition, -.hljs-attribute, -.hljs-link { - color: $pink-500; -} - -.hljs-comment, -.hljs-quote, -.hljs-meta, -.hljs-deletion { - color: #888; -} - -.hljs-keyword, -.hljs-selector-tag, -.hljs-section, -.hljs-name, -.hljs-type, -.hljs-strong { - font-weight: bold; -} - -.hljs-emphasis { - font-style: italic; -} - -body.dark .hljs { - background: $body-overlay-dark; - color: $body-color-dark; -} - -body.dark .hljs-string, -body.dark .hljs-variable, -body.dark .hljs-template-variable, -body.dark .hljs-symbol, -body.dark .hljs-bullet, -body.dark .hljs-section, -body.dark .hljs-addition, -body.dark .hljs-attribute, -body.dark .hljs-link { - color: $blue-300; -} diff --git a/assets/scss/components/_mermaid.scss b/assets/scss/components/_mermaid.scss new file mode 100644 index 0000000..3ff2488 --- /dev/null +++ b/assets/scss/components/_mermaid.scss @@ -0,0 +1,8 @@ +.mermaid { + margin: 1.5rem 0; + padding: 1.5rem; +} + +.mermaid svg { + height: auto; +} diff --git a/assets/scss/components/_syntax.scss b/assets/scss/components/_syntax.scss index d9a1c02..a439178 100644 --- a/assets/scss/components/_syntax.scss +++ b/assets/scss/components/_syntax.scss @@ -1,131 +1,62 @@ -/*! - * GitHub Light v0.5.0 - * Copyright (c) 2012 - 2017 GitHub, Inc. - * Licensed under MIT (https://github.com/primer/github-syntax-theme-generator/blob/master/LICENSE) - */ +/* - .c1, - .c /* comment, punctuation.definition.comment, string.comment */ { - color: #6a737d; - } - - .v /* variable */, - .smw /* sublimelinter.mark.warning */ { - color: #e36209; - } - - // .c1 /* constant, entity.name.constant, variable.other.constant, variable.language, support, meta.property-name, support.constant, support.variable, meta.module-reference, markup.raw, meta.diff.header, meta.output */, - .s .v /* string variable */ { - color: #005cc5; - } - - .e /* entity */, - .en /* entity.name */ { - color: #6f42c1; - } - - .smi /* variable.parameter.function, storage.modifier.package, storage.modifier.import, storage.type.java, variable.other */, - .s .s1 /* string source */ { - color: #24292e; - } - - .ent /* entity.name.tag, markup.quote */ { - color: #22863a; - } - - .k /* keyword, storage, storage.type */ { - color: #d73a49; - } - - .s /* string */, - .pds /* punctuation.definition.string, source.regexp, string.regexp.character-class */, - .s .pse .s1 /* string punctuation.section.embedded source */, - .sr /* string.regexp */, - .sr .cce /* string.regexp constant.character.escape */, - .sr .sre /* string.regexp source.ruby.embedded */, - .sr .sra /* string.regexp string.regexp.arbitrary-repitition */ { - color: #032f62; - } - - .bu /* invalid.broken, invalid.deprecated, invalid.unimplemented, message.error, brackethighlighter.unmatched, sublimelinter.mark.error */ { - color: #b31d28; - } - - .ii /* invalid.illegal */ { - color: #fafbfc; - background-color: #b31d28; - } - - .c2 /* carriage-return */ { - color: #fafbfc; - background-color: #d73a49; - } - - .c2::before /* carriage-return */ { - content: "^M"; - } - - .sr .cce /* string.regexp constant.character.escape */ { - font-weight: bold; - color: #22863a; - } - - .ml /* markup.list */ { - color: #735c0f; - } - - .mh /* markup.heading */, - .mh .en /* markup.heading entity.name */, - .ms /* meta.separator */ { - font-weight: bold; - color: #005cc5; - } - - .mi /* markup.italic */ { - font-style: italic; - color: #24292e; - } - - .mb /* markup.bold */ { - font-weight: bold; - color: #24292e; - } - - .md /* markup.deleted, meta.diff.header.from-file, punctuation.definition.deleted */ { - color: #b31d28; - background-color: #ffeef0; - } - - .mi1 /* markup.inserted, meta.diff.header.to-file, punctuation.definition.inserted */ { - color: #22863a; - background-color: #f0fff4; - } - - .mc /* markup.changed, punctuation.definition.changed */ { - color: #e36209; - background-color: #ffebda; - } - - .mi2 /* markup.ignored, markup.untracked */ { - color: #f6f8fa; - background-color: #005cc5; - } - - .mdr /* meta.diff.range */ { - font-weight: bold; - color: #6f42c1; - } - - .ba /* brackethighlighter.tag, brackethighlighter.curly, brackethighlighter.round, brackethighlighter.square, brackethighlighter.angle, brackethighlighter.quote */ { - color: #586069; - } - - .sg /* sublimelinter.gutter-mark */ { - color: #959da5; - } - - .corl /* constant.other.reference.link, string.other.link */ { - text-decoration: underline; - color: #032f62; - } - \ No newline at end of file +Based on Ascetic by (c) Ivan Sagalaev + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 1.25rem 1.5rem; + background: $beige; + color: $body-color; +} + +.hljs-string, +.hljs-variable, +.hljs-template-variable, +.hljs-symbol, +.hljs-bullet, +.hljs-section, +.hljs-addition, +.hljs-attribute, +.hljs-link { + color: $pink-500; +} + +.hljs-comment, +.hljs-quote, +.hljs-meta, +.hljs-deletion { + color: #888; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-section, +.hljs-name, +.hljs-type, +.hljs-strong { + font-weight: bold; +} + +.hljs-emphasis { + font-style: italic; +} + +body.dark .hljs { + background: $body-overlay-dark; + color: $body-color-dark; +} + +body.dark .hljs-string, +body.dark .hljs-variable, +body.dark .hljs-template-variable, +body.dark .hljs-symbol, +body.dark .hljs-bullet, +body.dark .hljs-section, +body.dark .hljs-addition, +body.dark .hljs-attribute, +body.dark .hljs-link { + color: $blue-300; +} diff --git a/config/_default/config.toml b/config/_default/config.toml index c800d6f..56fc5c8 100644 --- a/config/_default/config.toml +++ b/config/_default/config.toml @@ -73,10 +73,14 @@ rel = "sitemap" [taxonomies] contributor = "contributors" -[RelPermalinks] +[permalinks] blog = "/blog/:title/" [module] + [module.hugoVersion] + extended = true + min = "0.80.0" + max = "" [[module.mounts]] source = "assets" target = "assets" @@ -89,3 +93,6 @@ rel = "sitemap" [[module.mounts]] source = "node_modules/katex" target = "assets/js/vendor/katex" + [[module.mounts]] + source = "node_modules/mermaid" + target = "assets/js/vendor/mermaid" diff --git a/config/_default/params.toml b/config/_default/params.toml index ed44ae8..9601055 100644 --- a/config/_default/params.toml +++ b/config/_default/params.toml @@ -6,20 +6,34 @@ titleSeparator = "-" titleAddition = "Modern Documentation Theme" description = "Doks is a Hugo theme helping you build modern documentation websites that are secure, fast, and SEO-ready — by default." -## Open Graph + Twitter Cards +## Open Graph images = ["doks.png"] -twitterSite = "henkverlinde" -twitterCreator = "henkverlinde" -facebookAuthor = "verlinde.henk" -facebookPublisher = "verlinde.henk" ogLocale = "en_US" +domainTLD = "doks.netlify.app" +titleHome = "Doks Theme" + +## Twitter Cards +twitterSite = "@getdoks" +twitterCreator = "@henkverlinde" ## JSON-LD +# schemaType = "Person" schemaType = "Organization" +schemaName = "Doks" +schemaAuthor = "Henk Verlinde" +schemaAuthorTwitter = "https://twitter.com/henkverlinde" +schemaAuthorLinkedIn = "https://www.linkedin.com/in/henkverlinde/" +schemaAuthorGitHub = "https://github.com/h-enk" +schemaLocale = "en-US" schemaLogo = "logo-doks.png" -schemaTwitter = "https://twitter.com/henkverlinde" -schemaLinkedIn = "https://www.linkedin.com/in/henkverlinde/" -schemaGitHub = "https://github.com/h-enk" +schemaLogoWidth = 512 +schemaLogoHeight = 512 +schemaImage = "doks.png" +schemaImageWidth = 1280 +schemaImageHeight = 640 +schemaTwitter = "https://twitter.com/getdoks" +schemaLinkedIn = "" +schemaGitHub = "https://github.com/h-enk/doks" schemaSection = "blog" ## Sitelinks Search Box @@ -37,6 +51,7 @@ lqipWidth = "20x" # Footer footer = "Powered by Netlify, Hugo, and Doks" +copyRight = "Copyright (c) 2020-2021 Henk Verlinde" # Alert alert = false @@ -52,7 +67,8 @@ editPage = false instantPage = true flexSearch = true darkMode = true - bootStrapJs = false + bootStrapJs = true breadCrumb = false highLight = true kaTex = false + collapsibleSidebar = false diff --git a/config/postcss.config.js b/config/postcss.config.js index a97ab78..d5edc25 100644 --- a/config/postcss.config.js +++ b/config/postcss.config.js @@ -18,9 +18,13 @@ module.exports = { 'tr', 'th', 'td', + 'h5', + 'alert-link', ...whitelister([ - './assets/scss/components/_doks.scss', + './assets/scss/components/_buttons.scss', './assets/scss/components/_code.scss', + './assets/scss/components/_diagrams.scss', + './assets/scss/components/_syntax.scss', './assets/scss/components/_search.scss', './assets/scss/common/_dark.scss', './node_modules/katex/dist/katex.css', diff --git a/content/docs/help/how-to-update.md b/content/docs/help/how-to-update.md index 43cb1f4..f9bb36b 100644 --- a/content/docs/help/how-to-update.md +++ b/content/docs/help/how-to-update.md @@ -13,7 +13,7 @@ weight: 610 toc: true --- -{{< alert icon="💡" text="Learn more about semantic versioning and advanced range syntax." >}} +{{< alert icon="💡" text="Learn more about semantic versioning and advanced range syntax." />}} ## Check for outdated packages diff --git a/content/docs/prologue/commands.md b/content/docs/prologue/commands.md index b7922ee..e647a98 100644 --- a/content/docs/prologue/commands.md +++ b/content/docs/prologue/commands.md @@ -13,14 +13,12 @@ weight: 130 toc: true --- -{{< alert icon="💡" text="You can change the commands in the scripts section of `./package.json`." >}} +{{< alert icon="💡" text="You can change the commands in the scripts section of `./package.json`." />}} ## create Create new content for your site: -{{< btn-copy text="npm run create" >}} - ```bash npm run create [path] [flags] ``` @@ -31,8 +29,6 @@ See also the Hugo docs: [hugo new](https://gohugo.io/commands/hugo_new/). Check scripts, styles, and markdown for errors: -{{< btn-copy text="npm run lint" >}} - ```bash npm run lint ``` @@ -41,8 +37,6 @@ npm run lint Check scripts for errors: -{{< btn-copy text="npm run lint:scripts" >}} - ```bash npm run lint:scripts [-- --fix] ``` @@ -51,8 +45,6 @@ npm run lint:scripts [-- --fix] Check styles for errors: -{{< btn-copy text="npm run lint:styles" >}} - ```bash npm run lint:styles [-- --fix] ``` @@ -61,8 +53,6 @@ npm run lint:styles [-- --fix] Check markdown for errors: -{{< btn-copy text="npm run lint:markdown" >}} - ```bash npm run lint:markdown [-- --fix] ``` @@ -71,8 +61,6 @@ npm run lint:markdown [-- --fix] Delete temporary directories: -{{< btn-copy text="npm run clean" >}} - ```bash npm run clean ``` @@ -81,8 +69,6 @@ npm run clean Start local development server: -{{< btn-copy text="npm run start" >}} - ```bash npm run start ``` @@ -91,8 +77,6 @@ npm run start Build production website: -{{< btn-copy text="npm run build" >}} - ```bash npm run build ``` @@ -101,8 +85,6 @@ npm run build Build Lambda functions: -{{< btn-copy text="npm run build:functions" >}} - ```bash npm run build:functions ``` @@ -111,8 +93,6 @@ npm run build:functions Build production website including draft and future content: -{{< btn-copy text="npm run build:preview" >}} - ```bash npm run build:preview ``` diff --git a/content/docs/prologue/introduction.md b/content/docs/prologue/introduction.md index e1a62de..f215533 100644 --- a/content/docs/prologue/introduction.md +++ b/content/docs/prologue/introduction.md @@ -19,13 +19,13 @@ There are two main ways to get started with Doks: ### Tutorial -{{< alert icon="👉" text="The Tutorial is intended for novice to intermediate users." >}} +{{< alert icon="👉" text="The Tutorial is intended for novice to intermediate users." />}} Step-by-step instructions on how to start a new Doks project. [Tutorial →](https://getdoks.org/tutorial/introduction/) ### Quick Start -{{< alert icon="👉" text="The Quick Start is intended for intermediate to advanced users." >}} +{{< alert icon="👉" text="The Quick Start is intended for intermediate to advanced users." />}} One page summary of how to start a new Doks project. [Quick Start →]({{< relref "quick-start" >}}) diff --git a/content/docs/prologue/quick-start.md b/content/docs/prologue/quick-start.md index 89e1032..9282d3e 100644 --- a/content/docs/prologue/quick-start.md +++ b/content/docs/prologue/quick-start.md @@ -34,40 +34,30 @@ Not quite sure? Use the Doks child theme. #### Doks child theme -{{< btn-copy text="git clone https://github.com/h-enk/doks-child-theme.git my-doks-site" >}} - ```bash git clone https://github.com/h-enk/doks-child-theme.git my-doks-site ``` #### Doks starter theme -{{< btn-copy text="git clone https://github.com/h-enk/doks.git my-doks-site" >}} - ```bash git clone https://github.com/h-enk/doks.git my-doks-site ``` ### Change directories -{{< btn-copy text="cd my-doks-site" >}} - ```bash cd my-doks-site ``` ### Install dependencies -{{< btn-copy text="npm install" >}} - ```bash npm install ``` ### Start development server -{{< btn-copy text="npm run start" >}} - ```bash npm run start ``` diff --git a/data/doks.json b/data/doks.json deleted file mode 100644 index fdd05fa..0000000 --- a/data/doks.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "doks", - "version": "0.2.3" -} diff --git a/data/hyas.json b/data/hyas.json deleted file mode 100644 index 10a92ca..0000000 --- a/data/hyas.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "hyas", - "version": "1.3.5" -} \ No newline at end of file diff --git a/assets/lambda/hi-from-lambda.js b/functions/hi-from-lambda.js similarity index 100% rename from assets/lambda/hi-from-lambda.js rename to functions/hi-from-lambda.js diff --git a/layouts/_default/section.sitemap.xml b/layouts/_default/section.sitemap.xml index 9d047b4..701951d 100644 --- a/layouts/_default/section.sitemap.xml +++ b/layouts/_default/section.sitemap.xml @@ -4,19 +4,19 @@ {{ range $i, $e := .Data.Pages -}} {{ if ne .Params.sitemap_exclude true }} - {{ .RelPermalink }}{{ if not .Lastmod.IsZero }} + {{ .Permalink }}{{ if not .Lastmod.IsZero }} {{ safeHTML ( .Lastmod.Format "2006-01-02T15:04:05-07:00" ) }}{{ end }}{{ with .Sitemap.ChangeFreq }} {{ . }}{{ end }}{{ if ge .Sitemap.Priority 0.0 }} {{ .Sitemap.Priority }}{{ end }}{{ if .IsTranslated }}{{ range .Translations }} {{ end }} {{ end }} {{ end -}} @@ -25,19 +25,19 @@ {{ range $i, $e := .Data.Pages -}} {{ if ne .Params.sitemap_exclude true -}} - {{ .RelPermalink }}{{ if not .Lastmod.IsZero }} + {{ .Permalink }}{{ if not .Lastmod.IsZero }} {{ safeHTML ( .Lastmod.Format "2006-01-02T15:04:05-07:00" ) }}{{ end }}{{ with .Sitemap.ChangeFreq }} {{ . }}{{ end }}{{ if ge .Sitemap.Priority 0.0 }} {{ .Sitemap.Priority }}{{ end }}{{ if .IsTranslated }}{{ range .Translations }} {{ end }} {{ end }} {{ end -}} diff --git a/layouts/docs/single.html b/layouts/docs/single.html index 54e581b..c22f5e1 100644 --- a/layouts/docs/single.html +++ b/layouts/docs/single.html @@ -30,7 +30,11 @@ {{ if .Site.Params.editPage -}} {{ partial "main/edit-page.html" . }} {{ end -}} - {{ partial "main/docs-navigation.html" . }} + {{ if not .Site.Params.options.collapsibleSidebar -}} + {{ partial "main/docs-navigation.html" . }} + {{ else -}} +
+ {{ end -}} {{ end }} \ No newline at end of file diff --git a/layouts/index.headers b/layouts/index.headers index 31746da..ce35f41 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'; connect-src 'self'; font-src 'self'; img-src 'self' data:; script-src 'self'; style-src 'self' + Content-Security-Policy: default-src 'self'; frame-ancestors https://jamstackthemes.dev; manifest-src 'self'; connect-src 'self'; font-src 'self'; img-src 'self' data:; script-src 'self'; style-src 'self' 'unsafe-inline' X-Frame-Options: SAMEORIGIN Referrer-Policy: strict-origin Feature-Policy: geolocation 'self' diff --git a/layouts/index.html b/layouts/index.html index 87f3caa..9f0c752 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -7,7 +7,7 @@ diff --git a/layouts/index.redirects b/layouts/index.redirects index 59a844c..4323285 100644 --- a/layouts/index.redirects +++ b/layouts/index.redirects @@ -1,6 +1,6 @@ # redirects for Netlify - https://www.netlify.com/docs/redirects/ {{- range $p := .Site.Pages -}} {{- range .Aliases }} -{{ . }} {{ $p.RelRelPermalink -}} +{{ . }} {{ $p.RelPermalink -}} {{- end }} {{- end -}} \ No newline at end of file diff --git a/layouts/partials/footer/script-footer.html b/layouts/partials/footer/script-footer.html index c7b893b..64ccf13 100644 --- a/layouts/partials/footer/script-footer.html +++ b/layouts/partials/footer/script-footer.html @@ -10,6 +10,8 @@ {{ $katex := resources.Get "js/vendor/katex/dist/katex.js" -}} {{ $katexAutoRender := resources.Get "js/vendor/katex/dist/contrib/auto-render.js" -}} +{{ $mermaid := resources.Get "js/mermaid.js" | js.Build -}} + {{ $app := resources.Get "js/app.js" -}} {{ $slice := slice $app -}} @@ -33,7 +35,7 @@ {{ end -}} {{ if .Site.Params.options.flexSearch -}} - {{ $flexSearch := resources.Get "js/vendor/flexsearch/dist/flexsearch.min.js" -}} + {{ $flexSearch := resources.Get "js/vendor/flexsearch/dist/flexsearch.bundle.js" -}} {{ $slice = $slice | append $flexSearch -}} {{ end -}} @@ -63,6 +65,9 @@ {{ end -}} + {{ with .Params.mermaid -}} + + {{ end -}} {{ if .Site.Params.options.flexSearch -}} {{ end -}} @@ -73,6 +78,7 @@ {{ $highlight := $highlight | minify | fingerprint "sha512" -}} {{ $katex := $katex | minify | fingerprint "sha512" -}} {{ $katexAutoRender := $katexAutoRender | minify | fingerprint "sha512" -}} + {{ $mermaid := $mermaid | minify | fingerprint "sha512" -}} {{ if .Site.Params.options.bootStrapJs -}} {{ end -}} @@ -84,6 +90,9 @@ {{ end -}} + {{ with .Params.mermaid -}} + + {{ end -}} {{ if .Site.Params.options.flexSearch -}} {{ end -}} diff --git a/layouts/partials/head/favicons.html b/layouts/partials/head/favicons.html index e34e521..c034df1 100644 --- a/layouts/partials/head/favicons.html +++ b/layouts/partials/head/favicons.html @@ -1,5 +1,5 @@ - - - - \ No newline at end of file + + + + diff --git a/layouts/partials/head/opengraph.html b/layouts/partials/head/opengraph.html index e375302..6127e82 100644 --- a/layouts/partials/head/opengraph.html +++ b/layouts/partials/head/opengraph.html @@ -1,30 +1,15 @@ + + - {{ if $.Scratch.Get "paginator" -}} {{ $paginator := .Paginate (where .Site.RegularPages.ByDate.Reverse "Section" "blog" ) -}} - + {{ else -}} - + {{ end -}} - -{{ with $.Params.images -}} - {{ range first 6 . -}} - - {{ end -}} -{{ else -}} - {{ $images := $.Resources.ByType "image" -}} - {{ $featured := $images.GetMatch "*feature*" -}} - {{ if not $featured -}} - {{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }} - {{ end -}} - {{ with $featured -}} - - {{ else -}} - {{ with $.Site.Params.images -}} - - {{ end -}} - {{ end -}} +{{ with .Site.Params.title -}} + {{ end -}} {{ $iso8601 := "2006-01-02T15:04:05-07:00" -}} @@ -43,51 +28,42 @@ {{ end -}} {{ end -}} +{{ if eq .Kind "home" -}} + {{ .Scratch.Set "title" .Site.Params.titleHome -}} +{{ else -}} + {{ .Scratch.Set "title" .Title -}} +{{ end -}} + +{{ with $.Params.images -}} + {{ range first 6 . -}} + + {{ end -}} +{{ else -}} + {{ $images := $.Resources.ByType "image" -}} + {{ $featured := $images.GetMatch "*feature*" -}} + {{ if not $featured -}} + {{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }} + {{ end -}} + {{ with $featured -}} + + {{ else -}} + {{ with $.Site.Params.images -}} + + + {{ end -}} + {{ end -}} +{{ end -}} + +{{ with $.Site.Params.images -}} + {{ $.Scratch.Set "primaryImage" (index . 0 | absURL) -}} +{{ end -}} + {{ with .Params.audio -}} - -{{ end -}} -{{ with .Params.locale -}} - -{{ end -}} -{{ with .Site.Params.title -}} - + {{ end -}} + {{ with .Params.videos -}} {{ range . -}} - + {{ end -}} {{ end -}} - -{{ $RelPermalink := .RelPermalink -}} -{{ $siteSeries := .Site.Taxonomies.series -}} -{{ with .Params.series -}} - {{ range $name := . -}} - {{ $series := index $siteSeries $name -}} - {{ range $page := first 6 $series.Pages -}} - {{ if ne $page.RelPermalink $RelPermalink -}} - - {{ end -}} - {{ end -}} - {{ end -}} -{{ end -}} - -{{ if .IsPage -}} - {{ range .Site.Authors -}} - {{ with .Social.facebook -}} - - {{ end -}} - {{ with .Site.Social.facebook -}} - - {{ end -}} - - {{ with .Params.tags -}} - {{ range first 6 . -}} - - {{ end -}} - {{ end -}} - {{ end -}} -{{ end -}} - -{{ with .Site.Social.facebook_admin -}} - -{{ end -}} \ No newline at end of file diff --git a/layouts/partials/head/resource-hints.html b/layouts/partials/head/resource-hints.html index 754936d..3baa711 100644 --- a/layouts/partials/head/resource-hints.html +++ b/layouts/partials/head/resource-hints.html @@ -1,6 +1,6 @@ - - + + {{ if .Site.Params.options.kaTex -}} - - + + {{ end -}} \ No newline at end of file diff --git a/layouts/partials/head/seo.html b/layouts/partials/head/seo.html index fe21bb1..29aaef3 100644 --- a/layouts/partials/head/seo.html +++ b/layouts/partials/head/seo.html @@ -2,11 +2,11 @@ {{ else -}} {{ with .Params.robots -}} - + {{ else -}} - - - + + + {{ end -}} {{ end -}} @@ -23,28 +23,22 @@ {{ end -}} {{ if $.Scratch.Get "paginator" }} - + {{ if .Paginator.HasPrev -}} - + {{ end -}} {{ if .Paginator.HasNext -}} - + {{ end -}} -{{ else -}} - +{{ else -}} + {{ end -}} -{{ partial "head/twitter_cards.html" . }} - - - {{ partial "head/opengraph.html" . }} - - - +{{ partial "head/twitter_cards.html" . }} {{ range .AlternativeOutputFormats -}} - + {{ end -}} {{ partial "head/structured-data.html" . }} diff --git a/layouts/partials/head/structured-data.html b/layouts/partials/head/structured-data.html index 2f38fae..1f153a3 100644 --- a/layouts/partials/head/structured-data.html +++ b/layouts/partials/head/structured-data.html @@ -1,89 +1,10 @@ -{{ if .IsHome -}} - {{ if eq .Site.Params.schemaType "Organization" -}} - - {{ end -}} - {{ if eq .Site.Params.schemaType "Person" -}} - - {{ end -}} - {{ if .Site.Params.siteLinksSearchBox -}} - - {{ end -}} -{{ end -}} -{{ if .IsPage -}} - {{ if eq .Section .Site.Params.schemaSection -}} - - {{ end -}} -{{ end -}} +{{ $baseURL := "/" | absURL -}} {{ $dot := . -}} {{ $dot.Scratch.Set "path" "" -}} {{ $dot.Scratch.Set "breadcrumb" slice -}} -{{ $url := replace .RelPermalink ( printf "%s" .Site.BaseURL) "" -}} +{{ $url := replace .Permalink ( printf "%s" .Site.BaseURL) "" -}} {{ $.Scratch.Add "path" .Site.BaseURL -}} {{ $.Scratch.Add "breadcrumb" (slice (dict "url" .Site.BaseURL "name" "home" "position" 1 )) -}} @@ -97,13 +18,193 @@ \ No newline at end of file diff --git a/layouts/partials/head/stylesheet.html b/layouts/partials/head/stylesheet.html index 529e8f4..e5f9cc5 100644 --- a/layouts/partials/head/stylesheet.html +++ b/layouts/partials/head/stylesheet.html @@ -1,11 +1,11 @@ {{ if eq (hugo.Environment) "development" -}} {{ $options := (dict "targetPath" "main.css" "enableSourceMap" true "includePaths" (slice "node_modules")) -}} {{ $css := resources.Get "scss/app.scss" | toCSS $options -}} - + {{ else -}} {{ $options := (dict "targetPath" "main.css" "outputStyle" "compressed" "includePaths" (slice "node_modules")) -}} {{ $css := resources.Get "scss/app.scss" | toCSS $options | postCSS (dict "config" "config/postcss.config.js") -}} {{ $secureCSS := $css | resources.Fingerprint "sha512" -}} - + {{ end -}} \ No newline at end of file diff --git a/layouts/partials/head/twitter_cards.html b/layouts/partials/head/twitter_cards.html index 8086253..fdf581c 100644 --- a/layouts/partials/head/twitter_cards.html +++ b/layouts/partials/head/twitter_cards.html @@ -1,6 +1,10 @@ + + + + + {{ with $.Params.images -}} - - + {{ else -}} {{ $images := $.Resources.ByType "image" -}} {{ $featured := $images.GetMatch "*feature*" -}} @@ -8,26 +12,13 @@ {{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" -}} {{ end -}} {{ with $featured -}} - - + {{ else -}} {{ with $.Site.Params.images -}} - - + {{ else -}} {{ end -}} {{ end -}} {{ end -}} - - - -{{ with .Site.Social.twitter -}} - -{{ end -}} - -{{ range .Site.Authors -}} - {{ with .twitter -}} - - {{ end -}} -{{ end -}} \ No newline at end of file + \ No newline at end of file diff --git a/layouts/partials/sidebar/docs-menu.html b/layouts/partials/sidebar/docs-menu.html index 1f158d7..704b018 100644 --- a/layouts/partials/sidebar/docs-menu.html +++ b/layouts/partials/sidebar/docs-menu.html @@ -1,13 +1,39 @@ -{{ $currentPage := . -}} -{{ range .Site.Menus.docs -}} -

{{ .Name }}

- {{ if .HasChildren -}} -