Skip to content

Commit 17e1260

Browse files
docs: patch out OpenAPI version badge (#5)
Fixes the double badge on the API specs
2 parents 8d2f149 + f3b39a5 commit 17e1260

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

.github/workflows/build-and-deploy.yml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,19 @@ jobs:
7777
7878
# Load existing versions.json from deployed site or create empty
7979
if [ -f "${{ github.workspace }}/docs/versions.json" ]; then
80-
cp "${{ github.workspace }}/docs/versions.json" ./
81-
echo "✅ Loaded existing versions.json"
80+
# If we're building a specific version, exclude it from the imported versions.json
81+
if [ "${{ env.BUILDING_LATEST }}" != "true" ]; then
82+
# Filter out the version we're about to build
83+
node -e "
84+
const versions = JSON.parse(require('fs').readFileSync('${{ github.workspace }}/docs/versions.json', 'utf8'));
85+
const filtered = versions.filter(v => v !== '${{ env.VERSION_TAG }}');
86+
require('fs').writeFileSync('versions.json', JSON.stringify(filtered, null, 2));
87+
console.log('✅ Loaded versions.json (filtered out ${{ env.VERSION_TAG }})');
88+
"
89+
else
90+
cp "${{ github.workspace }}/docs/versions.json" ./
91+
echo "✅ Loaded existing versions.json"
92+
fi
8293
else
8394
echo "[]" > versions.json
8495
echo "✅ Created empty versions.json"
@@ -231,6 +242,16 @@ jobs:
231242
# Generate API docs for current build
232243
npm run gen-api-docs all
233244
245+
# Patch out duplicate version badges from OpenAPI MDX files
246+
echo "🔧 Patching out duplicate version badges..."
247+
find . -name "llama-stack-specification.info.mdx" -type f -exec sed -i '/<span$/,/<\/span>$/d' {} \;
248+
249+
# Also patch versioned files if they exist
250+
if [ -d "versioned_docs" ]; then
251+
find versioned_docs -name "llama-stack-specification.info.mdx" -type f -exec sed -i '/<span$/,/<\/span>$/d' {} \;
252+
fi
253+
echo "✅ Version badge patching completed"
254+
234255
# Build the site
235256
npm run build
236257

versioned_docs/version-v0.2.23/api/llama-stack-specification.info.mdx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@ import SchemaTabs from "@theme/SchemaTabs";
1414
import TabItem from "@theme/TabItem";
1515
import Export from "@theme/ApiExplorer/Export";
1616

17-
<span
18-
className={"theme-doc-version-badge badge badge--secondary"}
19-
children={"Version: v1"}
20-
>
21-
</span>
2217

2318
<Export
2419
url={"https://raw.githubusercontent.com/meta-llama/llama-stack/main/docs/static/llama-stack-spec.yaml"}

0 commit comments

Comments
 (0)