wrapper-manager-fds/docs: update Hugo config

This commit is contained in:
Gabriel Arazas 2024-07-16 18:37:40 +08:00
parent 699c547947
commit 9433f9a07d
4 changed files with 76 additions and 21 deletions

49
docs/assets/js/site.js Normal file
View File

@ -0,0 +1,49 @@
(function() {
// Set up shop for QoL code listing features.
var codeListings = document.querySelectorAll("main .listingblock > .content, main .literalblock > .content");
for (elem of codeListings) {
var parent = elem.parentElement;
var fullscreenButton = document.createElement("button");
fullscreenButton.classList.add("listingblock__fullscreen-btn");
fullscreenButton.ariaLabel = "{{ T "fullscreenButtonAriaLabel" }}";
fullscreenButton.title = "{{ T "fullscreenButtonLabel" }}";
fullscreenButton.ariaDescription = "{{ T "fullscreenButtonDescription" }}";
fullscreenButton.innerHTML = `{{- partial "components/heroicon.html" (dict "id" "arrows-pointing-out") | safeHTML }}`;
fullscreenButton.addEventListener("click", (event) => {
const { target } = event;
const parent = target.closest(".listingblock") || target.closest(".literalblock");
if (!document.fullscreenElement) {
parent.requestFullscreen();
} else if (document.exitFullscreen) {
document.exitFullscreen();
}
});
var copyButton = document.createElement("button");
copyButton.classList.add("listingblock__copy-btn");
copyButton.ariaLabel = "{{ T "copyButtonAriaLabel" }}";
copyButton.title = "{{ T "copyButtonLabel" }}";
copyButton.ariaDescription = "{{ T "copyButtonDescription" }}";
copyButton.innerHTML = `{{- partial "components/heroicon.html" (dict "id" "clipboard") }}`;
copyButton.addEventListener("click", (event) => {
const { target } = event;
const parent = target.closest(".listingblock");
const codeListing = parent.querySelector(".content");
navigator.clipboard.writeText(codeListing.textContent.trim());
});
var buttonRow = document.createElement("div");
buttonRow.classList.add("listingblock__btn-row");
if (parent.classList.contains("listingblock")) {
buttonRow.appendChild(copyButton);
}
buttonRow.appendChild(fullscreenButton);
parent.appendChild(buttonRow);
}
})()

View File

@ -11,3 +11,7 @@ allow = [
"^go$", "^go$",
"^asciidoctor$", "^asciidoctor$",
] ]
osEnv = [ '^LAST_COMMIT_DATE$' ]
[security.funcs]
getenv = [ "^LAST_COMMIT_DATE$" ]

View File

@ -17,18 +17,11 @@ linkcss = true
cache-uri = true cache-uri = true
reproducible = true reproducible = true
stem = "latexmath" stem = "latexmath"
env-hugo = true
avatarsdir = "/nixos-config/icons/avatars" avatarsdir = "/wrapper-manager-fds/icons/avatars"
avatarstype = "svg" avatarstype = "svg"
icons = "image" icons = "image"
iconsdir = "/nixos-config/icons/asciidoctor" iconsdir = "/wrapper-manager-fds/icons/asciidoctor"
icontype = "svg" icontype = "svg"
# Project-wide attributes to be used.
github-repo = "foo-dogsquared/nixos-config"
canonical-flake-url = "github:foo-dogsquared/nixos-config"
canonical-source-repo = "https://github.com/foo-dogsquared/nixos-config"
canonical-flake-url-tarball-master = "https://github.com/foo-dogsquared/nixos-config/archive/master.tar.gz"
canonical-flake-url-tarball-specific = "https://github.com/foo-dogsquared/nixos-config/archive/35c27749c55077727529f412dade862e4deb2ae8.tar.gz"
devos-link = "https://github.com/divnix/digga/tree/580fc57ffaaf9cf3a582372235759dccfe44ac92/examples/devos"

View File

@ -1,14 +1,5 @@
[[imports]]
path = "github.com/foo-dogsquared/hugo-theme-more-contentful"
[[imports]] [[imports]]
path = "github.com/foo-dogsquared/website" path = "github.com/foo-dogsquared/website"
ignoreConfig = true
ignoreImports = true
[[imports.mounts]]
source = "assets/svg/avatars/"
target = "static/icons/avatars/"
[[imports.mounts]] [[imports.mounts]]
source = "assets/scss/" source = "assets/scss/"
@ -19,8 +10,26 @@ source = "assets/css/"
target = "assets/css/" target = "assets/css/"
[[imports.mounts]] [[imports.mounts]]
source = "layouts/partials/" source = "layouts/partials"
target = "layouts/partials/" target = "layouts/partials"
excludeFiles = [ "footer.html" ]
[[imports.mounts]]
source = "layouts/_default"
target = "layouts/_default"
includeFiles = [ "baseof.html" ]
[[imports.mounts]]
source = "assets/svg/avatars/"
target = "static/icons/avatars/"
[[imports.mounts]]
source = "assets/svg/avatars/"
target = "assets/svg/avatars/"
[[imports.mounts]]
source = "i18n/"
target = "i18n/"
[[imports.mounts]] [[imports.mounts]]
source = "data/more-contentful/themes/" source = "data/more-contentful/themes/"