From c583223c3529af230084083fe1c6620dbd6cfe46 Mon Sep 17 00:00:00 2001 From: Yatharth Yadav Date: Tue, 27 Jan 2026 03:15:24 +0530 Subject: [PATCH] feat: add copy button for code blocks --- config.toml | 11 +++---- data/chunky-poster/assets.json | 6 ++++ layouts/_default/baseof.html | 16 ++++++++++ layouts/partials/authors.html | 40 +++++++++++++++++++++++++ layouts/partials/foot.html | 21 +++++++++++++ layouts/partials/i18nlist.html | 6 ++++ layouts/partials/related.html | 10 +++++++ layouts/partials/sharer.html | 24 +++++++++++++++ static/css/copy-code.css | 55 ++++++++++++++++++++++++++++++++++ static/js/copy-code.js | 50 +++++++++++++++++++++++++++++++ 10 files changed, 234 insertions(+), 5 deletions(-) create mode 100644 data/chunky-poster/assets.json create mode 100644 layouts/_default/baseof.html create mode 100644 layouts/partials/authors.html create mode 100644 layouts/partials/foot.html create mode 100644 layouts/partials/i18nlist.html create mode 100644 layouts/partials/related.html create mode 100644 layouts/partials/sharer.html create mode 100644 static/css/copy-code.css create mode 100644 static/js/copy-code.js diff --git a/config.toml b/config.toml index d1a20b3f..f0b5cb24 100755 --- a/config.toml +++ b/config.toml @@ -1,9 +1,10 @@ baseURL = "https://CollaboraOnline.github.io" -RelativeURLs=true +RelativeURLs=false CanonifyURLs=true title = "Collabora Online - Community Page" copyright = "Unless a license is otherwise specified, content is under CC-BY-SA 3.0

Beaver illustrations are under Copyright © 2025 Collabora Ltd. All rights reserved." -paginate = 2 +[pagination] + pagerSize = 2 languageCode = "en" DefaultContentLanguage = "en" enableInlineShortcodes = true @@ -53,8 +54,8 @@ type = "type" showLanguageSwitcher = false # Custom CSS and JS. Relative to /static/css and /static/js respectively. - customCSS = ["buttons.css", "anim.css", "header.css", "dropdown.css", "sidebar.css", "post-content.css"] - customJS = [] + customCSS = ["buttons.css", "anim.css", "header.css", "dropdown.css", "sidebar.css", "post-content.css", "copy-code.css"] + customJS = ["copy-code.js"] [params.social] rss = true @@ -91,5 +92,5 @@ type = "type" [services.instagram] disableInlineCSS = true - [services.twitter] + [services.x] disableInlineCSS = true diff --git a/data/chunky-poster/assets.json b/data/chunky-poster/assets.json new file mode 100644 index 00000000..c06480de --- /dev/null +++ b/data/chunky-poster/assets.json @@ -0,0 +1,6 @@ +{ + "main": { + "css": "main.37ab3f61b95417873748.min.css", + "js": "main.d608eadfe5ac0688902e.min.js" + } +} \ No newline at end of file diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html new file mode 100644 index 00000000..091995bc --- /dev/null +++ b/layouts/_default/baseof.html @@ -0,0 +1,16 @@ + + + + {{ partial "head.html" . }} + + + {{ partial "header.html" . }} + + {{ block "main" . }}{{ end }} + + {{ partial "footer.html" . }} + {{ partial "foot.html" . }} + + {{ template "_internal/google_analytics.html" . }} + + diff --git a/layouts/partials/authors.html b/layouts/partials/authors.html new file mode 100644 index 00000000..7bc3b472 --- /dev/null +++ b/layouts/partials/authors.html @@ -0,0 +1,40 @@ +{{- if .Params.authors -}} + +{{- end -}} diff --git a/layouts/partials/foot.html b/layouts/partials/foot.html new file mode 100644 index 00000000..5cdc5572 --- /dev/null +++ b/layouts/partials/foot.html @@ -0,0 +1,21 @@ +{{ with index .Site.Data "chunky-poster" }} + {{ range $vendor := .assets }} + {{ if $vendor.js }} + + {{ end }} + {{ end }} +{{ end }} + +{{ if .Site.Params.prismJS.enable }} + + + +{{ end }} + +{{ range .Site.Params.customJS -}} + +{{ end }} + diff --git a/layouts/partials/i18nlist.html b/layouts/partials/i18nlist.html new file mode 100644 index 00000000..486e1f3e --- /dev/null +++ b/layouts/partials/i18nlist.html @@ -0,0 +1,6 @@ +{{ if .IsTranslated }} + {{ range .Translations }} + + {{ end}} +{{ end }} diff --git a/layouts/partials/related.html b/layouts/partials/related.html new file mode 100644 index 00000000..9dbae449 --- /dev/null +++ b/layouts/partials/related.html @@ -0,0 +1,10 @@ +{{- $related := .Site.RegularPages.Related . | first 3 -}} +{{- with $related -}} + +{{- end -}} diff --git a/layouts/partials/sharer.html b/layouts/partials/sharer.html new file mode 100644 index 00000000..79d6c72c --- /dev/null +++ b/layouts/partials/sharer.html @@ -0,0 +1,24 @@ +{{- if and .Site.Params.share (ne .Params.share false) -}} +