Skip to content

Commit 9e93e37

Browse files
1technophileclaude
andauthored
[DOCS] Restore dev-version banner gate after VitePress migration (1technophile#2305)
The VuePress->VitePress migration replaced the `themeConfig.mode === 'dev'` gate with a heuristic on `site.title`. CI overrides version with a short SHA (dev) or git tag (prod), so the title never contains "edge"/"dev" and the banner never renders on live deploys. Surface `meta.mode` in `themeConfig` and check it directly, mirroring the original behaviour. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent ddd05eb commit 9e93e37

2 files changed

Lines changed: 16 additions & 3 deletions

File tree

docs/.vitepress/config.mts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ export default defineConfig({
3232
},
3333
themeConfig: {
3434
siteTitle: 'OpenMQTTGateway',
35+
// @ts-expect-error custom fields consumed by index.md to render the dev-version banner
36+
mode: meta.mode,
37+
// @ts-expect-error
38+
version: meta.version,
39+
// @ts-expect-error
40+
repo: meta.theme_config_repo,
3541
nav: commonNav,
3642
socialLinks: [
3743
{ icon: 'github', link: `https://github.com/${meta.theme_config_repo}` }

docs/index.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
<script setup>
22
import { useData } from 'vitepress'
3-
const { site } = useData()
4-
const isDev = site.value.title?.includes('edge') || site.value.title?.includes('dev')
3+
import { computed } from 'vue'
4+
const { theme } = useData()
5+
const isDev = theme.value.mode === 'dev'
6+
const version = theme.value.version
7+
const commitUrl = computed(() =>
8+
theme.value.repo && version
9+
? `https://github.com/${theme.value.repo}/commit/${version}`
10+
: null
11+
)
512
</script>
613

714
<div v-if="isDev" class="warning custom-block">
815
<p class="custom-block-title">Development Version</p>
9-
<p>This is the edge version of the documentation. It is under active development and may contain bugs, incomplete features, or breaking changes. Use it at your own risk.</p>
16+
<p>This is the edge version of the documentation, built from commit <a v-if="commitUrl" :href="commitUrl"><code>{{ version }}</code></a><code v-else>{{ version }}</code>. It is under active development and may contain bugs, incomplete features, or breaking changes. Use it at your own risk.</p>
1017
</div>
1118

1219
OpenMQTTGateway aims to unify various technologies and protocols into a single firmware. This reduces the need for multiple physical bridges and streamlines diverse technologies under the widely-used [MQTT](http://mqtt.org/) protocol.

0 commit comments

Comments
 (0)