From 0577dc0be1daac5b6c79b5afb0376ac60303e2a8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 16 Apr 2026 06:51:51 +0000 Subject: [PATCH 1/2] Initial plan From f484a8a7e471879cd1eadc24e6c27faa53f5cb35 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 16 Apr 2026 06:56:01 +0000 Subject: [PATCH 2/2] fix: correct bizard-skill.zip relative path on sub-pages The segmentsAfterRoot calculation used parts.length - 2 (subtracting only the empty string and site root), but forgot to subtract the filename itself. Pages like /Bizard/Distribution/Density.html ended up with ../../bizard-skill.zip resolving to /bizard-skill.zip instead of /Bizard/bizard-skill.zip. Fix: use Math.max(0, parts.length - 3) in skill-button.lua, Skills.qmd, and Skills.zh.qmd. Agent-Logs-Url: https://github.com/openbiox/Bizard/sessions/e8c5f250-0592-47e3-8660-74694f4374fd Co-authored-by: ShixiangWang <25057508+ShixiangWang@users.noreply.github.com> --- Skills.qmd | 2 +- Skills.zh.qmd | 2 +- skill-button.lua | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Skills.qmd b/Skills.qmd index 78014753d..388eaddcd 100644 --- a/Skills.qmd +++ b/Skills.qmd @@ -50,7 +50,7 @@ The ZIP contains: // Fix download link paths for pages served under subdirectories (e.g. zh/) (function() { var parts = window.location.pathname.replace(/\/+$/, '').split('/'); - var segmentsAfterRoot = parts.length - 2; + var segmentsAfterRoot = Math.max(0, parts.length - 3); var prefix = ''; for (var i = 0; i < segmentsAfterRoot; i++) prefix += '../'; if (!prefix) prefix = './'; diff --git a/Skills.zh.qmd b/Skills.zh.qmd index 9b22a9f92..0c53da355 100644 --- a/Skills.zh.qmd +++ b/Skills.zh.qmd @@ -50,7 +50,7 @@ ZIP 包含: // Fix download link paths for pages served under subdirectories (e.g. zh/) (function() { var parts = window.location.pathname.replace(/\/+$/, '').split('/'); - var segmentsAfterRoot = parts.length - 2; + var segmentsAfterRoot = Math.max(0, parts.length - 3); var prefix = ''; for (var i = 0; i < segmentsAfterRoot; i++) prefix += '../'; if (!prefix) prefix = './'; diff --git a/skill-button.lua b/skill-button.lua index bae292f79..d5c841ad4 100644 --- a/skill-button.lua +++ b/skill-button.lua @@ -35,8 +35,8 @@ function Pandoc(doc) var parts = window.location.pathname.replace(/\/+$/, '').split('/'); // parts: ['', 'Bizard', 'Category', 'Page.html'] or ['', 'Bizard', 'zh', 'Category', 'Page.html'] // We need to go up from the page to the site root (where bizard-skill.zip lives). - // Count path segments after the site root. - var segmentsAfterRoot = parts.length - 2; // minus '' and site-root + // Count directory segments between site-root and the file (exclude '' + site-root + filename). + var segmentsAfterRoot = Math.max(0, parts.length - 3); // minus '', site-root, and filename var prefix = ''; for (var i = 0; i < segmentsAfterRoot; i++) prefix += '../'; if (!prefix) prefix = './';