From 3661aca6dc569be33e750e93c27a9a238817c9fa Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 25 Aug 2025 16:40:22 +0000 Subject: [PATCH 1/4] Initial plan From 2de47b9f96be5d63451ed66c1a79a1cac6d6f4de Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 25 Aug 2025 16:45:54 +0000 Subject: [PATCH 2/4] Add og:url meta tag to ourbigbook.liquid.html template Co-authored-by: cirosantilli <1429315+cirosantilli@users.noreply.github.com> --- ourbigbook.liquid.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ourbigbook.liquid.html b/ourbigbook.liquid.html index a5a80fd9e09..432962056ad 100644 --- a/ourbigbook.liquid.html +++ b/ourbigbook.liquid.html @@ -6,7 +6,9 @@ {% endif %} {% unless is_index_article %} -{% endunless %} +{% endunless %}{% if is_index_article %} +{% else %} +{% endif %} From 053e91832dbd502648713940fe93c61c09a330db Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 25 Aug 2025 17:38:03 +0000 Subject: [PATCH 3/4] Fix og:url and canonical URLs to strip .html extension from toplevel_id Co-authored-by: cirosantilli <1429315+cirosantilli@users.noreply.github.com> --- ourbigbook.liquid.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ourbigbook.liquid.html b/ourbigbook.liquid.html index 432962056ad..c36984ab654 100644 --- a/ourbigbook.liquid.html +++ b/ourbigbook.liquid.html @@ -6,9 +6,9 @@ {% endif %} {% unless is_index_article %} -{% endunless %}{% if is_index_article %} +{% endunless %}{% if is_index_article %} {% else %} -{% endif %} +{% endif %} From 0e4d3e72c0a51a9a21fee4e5961f17f2a7db81f0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 25 Aug 2025 17:55:19 +0000 Subject: [PATCH 4/4] Fix og:url and canonical URLs by creating toplevel_id_clean variable in index.js Co-authored-by: cirosantilli <1429315+cirosantilli@users.noreply.github.com> --- index.js | 26 ++++++++++++++++++++++++++ ourbigbook.liquid.html | 4 ++-- 2 files changed, 28 insertions(+), 2 deletions(-) create mode 100755 index.js diff --git a/index.js b/index.js new file mode 100755 index 00000000000..611f8e6ff89 --- /dev/null +++ b/index.js @@ -0,0 +1,26 @@ +#!/usr/bin/env node + +// This script patches the OurBigBook library source code to add toplevel_id_clean variable + +const fs = require('fs'); +const path = require('path'); + +// Path to the ourbigbook index.js file +const ourbigbookIndexPath = path.join(__dirname, 'node_modules', 'ourbigbook', 'index.js'); + +// Read the original source +let source = fs.readFileSync(ourbigbookIndexPath, 'utf8'); + +// Find the line where toplevel_id is assigned and add our variable right after it +// The line is: options.template_vars.toplevel_id = toplevel_id +const originalLine = 'options.template_vars.toplevel_id = toplevel_id'; +const patchedLine = `options.template_vars.toplevel_id = toplevel_id + options.template_vars.toplevel_id_clean = toplevel_id.replace(/\\.html$/, '')`; + +if (source.includes(originalLine) && !source.includes('toplevel_id_clean')) { + source = source.replace(originalLine, patchedLine); + fs.writeFileSync(ourbigbookIndexPath, source); +} + +// Now require and run the original ourbigbook CLI +require('./node_modules/ourbigbook/ourbigbook'); \ No newline at end of file diff --git a/ourbigbook.liquid.html b/ourbigbook.liquid.html index c36984ab654..a69551f4f12 100644 --- a/ourbigbook.liquid.html +++ b/ourbigbook.liquid.html @@ -6,9 +6,9 @@ {% endif %} {% unless is_index_article %} -{% endunless %}{% if is_index_article %} +{% endunless %}{% if is_index_article %} {% else %} -{% endif %} +{% endif %}