From 724a6cad0d6f00ae0c98b903ef2f4b14ad1447e6 Mon Sep 17 00:00:00 2001
From: 23prime <23.prime.37@gmail.com>
Date: Tue, 10 Mar 2026 13:00:58 +0900
Subject: [PATCH 1/3] feat: show version in docs navbar
---
.github/workflows/docs.yml | 2 ++
website/docusaurus.config.js | 7 +++++++
2 files changed, 9 insertions(+)
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
index d9ec3e5..732a8cd 100644
--- a/.github/workflows/docs.yml
+++ b/.github/workflows/docs.yml
@@ -31,6 +31,8 @@ jobs:
- name: Build
run: pnpm build
working-directory: website
+ env:
+ DOCS_VERSION: ${{ github.ref_name }}
- uses: actions/upload-pages-artifact@v4
with:
diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js
index 72d598d..ffedfe8 100644
--- a/website/docusaurus.config.js
+++ b/website/docusaurus.config.js
@@ -1,5 +1,7 @@
// @ts-check
+const version = process.env.DOCS_VERSION || 'dev';
+
/** @type {import('@docusaurus/types').Config} */
const config = {
// title: 'backlog-cli',
@@ -58,6 +60,11 @@ const config = {
type: 'localeDropdown',
position: 'right',
},
+ {
+ type: 'html',
+ position: 'right',
+ value: `${version}`,
+ },
{
href: 'https://github.com/23prime/backlog-cli',
label: 'GitHub',
From 961054e0f1df15fe320daf730c9c1d552e4af4cb Mon Sep 17 00:00:00 2001
From: 23prime <23.prime.37@gmail.com>
Date: Tue, 10 Mar 2026 13:04:58 +0900
Subject: [PATCH 2/3] fix: set DOCS_VERSION only for tag builds to preserve dev
fallback
Addresses review comment: on workflow_dispatch runs github.ref_name is the branch name not a tag
---
.github/workflows/docs.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
index 732a8cd..ae1e889 100644
--- a/.github/workflows/docs.yml
+++ b/.github/workflows/docs.yml
@@ -32,7 +32,7 @@ jobs:
run: pnpm build
working-directory: website
env:
- DOCS_VERSION: ${{ github.ref_name }}
+ DOCS_VERSION: ${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || '' }}
- uses: actions/upload-pages-artifact@v4
with:
From 4fff8d70fefa9a567472a6813f587443682bcc7d Mon Sep 17 00:00:00 2001
From: 23prime <23.prime.37@gmail.com>
Date: Tue, 10 Mar 2026 13:05:40 +0900
Subject: [PATCH 3/3] fix: escape HTML in navbar version label
Addresses review comment: version string interpolated into HTML should be escaped
---
website/docusaurus.config.js | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js
index ffedfe8..70869a4 100644
--- a/website/docusaurus.config.js
+++ b/website/docusaurus.config.js
@@ -2,6 +2,15 @@
const version = process.env.DOCS_VERSION || 'dev';
+/** @param {string} str */
+function escapeHtml(str) {
+ return str
+ .replace(/&/g, '&')
+ .replace(//g, '>')
+ .replace(/"/g, '"');
+}
+
/** @type {import('@docusaurus/types').Config} */
const config = {
// title: 'backlog-cli',
@@ -63,7 +72,7 @@ const config = {
{
type: 'html',
position: 'right',
- value: `${version}`,
+ value: `${escapeHtml(version)}`,
},
{
href: 'https://github.com/23prime/backlog-cli',