diff options
| author | XhmikosR <[email protected]> | 2020-11-22 17:34:23 +0200 |
|---|---|---|
| committer | XhmikosR <[email protected]> | 2020-11-22 17:36:00 +0200 |
| commit | 96f7e9f79804405b64c7f6c83f0b31cdd1e8824f (patch) | |
| tree | daf219e761efad64e18941b210445d864ce57d35 | |
| parent | 010192a6f362b39ef0295f1370771e1065e1664f (diff) | |
| download | bootstrap-main-xmr-hugo-docs-vendor.tar.xz bootstrap-main-xmr-hugo-docs-vendor.zip | |
| -rw-r--r-- | config.yml | 4 | ||||
| -rw-r--r-- | site/layouts/partials/func/get-js-assets.html | 17 | ||||
| -rw-r--r-- | site/layouts/partials/scripts.html | 6 |
3 files changed, 9 insertions, 18 deletions
diff --git a/config.yml b/config.yml index eafd87945..cd3f21007 100644 --- a/config.yml +++ b/config.yml @@ -42,9 +42,9 @@ module: target: static/favicon.ico # the following are processed via Hugo pipes so we need them in the assets folder - ## the following will be printed with Hugo pipes + ## the following will be served as is - source: node_modules/docsearch.js/dist/cdn/docsearch.min.js - target: assets/js/vendor/docsearch.min.js + target: static/docs/5.0/assets/js/vendor/docsearch.min.js ## The following vendor files will be bundled together on top of local js files as /docs.js - source: node_modules/anchor-js/anchor.min.js target: assets/js/vendor/anchor.min.js diff --git a/site/layouts/partials/func/get-js-assets.html b/site/layouts/partials/func/get-js-assets.html index 351e9ad1d..304107d7c 100644 --- a/site/layouts/partials/func/get-js-assets.html +++ b/site/layouts/partials/func/get-js-assets.html @@ -20,31 +20,18 @@ {{/* Storing the reused mount warning message */}} {{ $missing_file_warning := "%s not found. Check your mounts settings and/or run `npm i`." }} {{ $doc_version := site.Params.docs_version }} -{{/* Doc Search */}} -{{ if eq .Page.Layout "docs" -}} - {{ with resources.GetMatch "js/vendor/docsearch.min.js" }} - {{/* As this is a WIP, we don't customize the asset URL, - but we will after Hugo .74 and resources.Put (https://github.com/gohugoio/hugo/issues/7406): - {{ with resources.GetMatch "js/vendor/docsearch.min.js" }} - {{ $docsearch := . | resources.Put (printf /docs/%s/assets/js/vendor/docsearch.min.js" $doc_version) }} - {{ $jsAssets = $jsAssets | append $docsearch }} - */}} - {{ $jsAssets = $jsAssets | append . }} - {{ else }} - {{ errorf $missing_file_warning "docsearch.min.js" }} - {{ end }} -{{- end }} {{/* --- Bundle */}} {{ $bundle := slice }} {{/* ----- Mounted from vendors */}} {{- $vendor_assets := slice -}} + {{/* As we need to list the desired mounted files to: 1. Check for missing mounts and throw an error 2. Control order if need be 3. Exclude docsearch (though there would be other ways) */}} -{{ $vendor_filenames := slice "clipboard.min.js" "anchor.min.js" }} +{{ $vendor_filenames := slice "anchor.min.js" "clipboard.min.js" }} {{ range $filename := $vendor_filenames }} {{ with resources.GetMatch (print "js/vendor/" .) }} {{ $vendor_assets = $vendor_assets | append . }} diff --git a/site/layouts/partials/scripts.html b/site/layouts/partials/scripts.html index f19a9b582..674724a55 100644 --- a/site/layouts/partials/scripts.html +++ b/site/layouts/partials/scripts.html @@ -4,7 +4,11 @@ <script src="/docs/{{ .Site.Params.docs_version }}/dist/js/bootstrap.bundle.js"></script> {{- end }} -{{- $variant := cond (eq .Page.Layout "docs") "docs" "default" -}} +{{ if eq .Page.Layout "docs" -}} +<script src="/docs/{{ .Site.Params.docs_version }}/assets/js/vendor/docsearch.min.js"></script> +{{- end }} + +{{ $variant := cond (eq .Page.Layout "docs") "docs" "default" -}} {{- range partialCached "func/get-js-assets" . $variant -}} <script src="{{ .RelPermalink }}"></script> {{- end -}} |
