From d3ef78c103b2336b18394cbd6f27142ee99fe209 Mon Sep 17 00:00:00 2001 From: vincent Date: Thu, 25 Apr 2024 16:13:09 -0400 Subject: [PATCH 1/3] Add new custom JS plugin for analytics integration --- plugins/add-custom-js/assets/add-custom-js.js | 5 +++++ plugins/add-custom-js/index.js | 9 +++++++++ plugins/add-custom-js/package.json | 8 ++++++++ 3 files changed, 22 insertions(+) create mode 100644 plugins/add-custom-js/assets/add-custom-js.js create mode 100644 plugins/add-custom-js/index.js create mode 100644 plugins/add-custom-js/package.json diff --git a/plugins/add-custom-js/assets/add-custom-js.js b/plugins/add-custom-js/assets/add-custom-js.js new file mode 100644 index 00000000..10df10fb --- /dev/null +++ b/plugins/add-custom-js/assets/add-custom-js.js @@ -0,0 +1,5 @@ +var script = document.createElement('script'); +script.src = 'https://analytics.hypha.coop/js/script.js'; +script.defer = true; +script.setAttribute('data-domain', 'handbook.hypha.coop'); +document.head.appendChild(script); diff --git a/plugins/add-custom-js/index.js b/plugins/add-custom-js/index.js new file mode 100644 index 00000000..ddbe9484 --- /dev/null +++ b/plugins/add-custom-js/index.js @@ -0,0 +1,9 @@ +module.exports = { + website: { + assets: "./assets", + js: [ + "add-custom-js.js" + ] + } + }; + \ No newline at end of file diff --git a/plugins/add-custom-js/package.json b/plugins/add-custom-js/package.json new file mode 100644 index 00000000..2b145c41 --- /dev/null +++ b/plugins/add-custom-js/package.json @@ -0,0 +1,8 @@ +{ + "name": "add-custom-js", + "version": "1.0.0", + "engines": { + "honkit": "^4.0.8" + } + } + \ No newline at end of file From faea292c0749feb7fda3b45255dcf323e140b61c Mon Sep 17 00:00:00 2001 From: vincent Date: Thu, 25 Apr 2024 16:14:27 -0400 Subject: [PATCH 2/3] Configure book.json to use the custom JS plugin --- book.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/book.json b/book.json index 6bc1184f..6bc4a7d7 100644 --- a/book.json +++ b/book.json @@ -6,6 +6,7 @@ "readme": "handbook.md" }, "plugins": [ - "anchors" + "anchors", + "add-custom-js" ] } From dfbd640f2d08dbb95f363a72f289ef0012f48c9d Mon Sep 17 00:00:00 2001 From: vincent Date: Thu, 25 Apr 2024 16:14:43 -0400 Subject: [PATCH 3/3] Include add-custom-js plugin as a local dependency --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index e2f91aae..3fa51a1f 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,8 @@ "description": "Hypha handbook describes the vision, processes, and culture of Hypha Worker Co-operative. πŸŒΏπŸ„", "devDependencies": { "gitbook-plugin-anchors": "^0.7.1", - "honkit": "^4.0.8" + "honkit": "^4.0.8", + "add-custom-js": "file:plugins/add-custom-js" }, "repository": { "type": "git",