Skip to content

Commit 9f3e85a

Browse files
author
rhorenov
committed
Site: Respect config.base (VITEPRESS_BASE) variable in Vue components too
1 parent 55ec984 commit 9f3e85a

8 files changed

Lines changed: 24 additions & 11 deletions

File tree

docs/.vitepress/theme/components/blog/BlogCard.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div class="blog-card">
33
<div class="blog-card-header">
44
<h3 class="blog-card-title">
5-
<a :href="post.url">{{ post.title }}</a>
5+
<a :href="withBase(post.url)">{{ post.title }}</a>
66
</h3>
77
<div class="blog-card-meta">
88
<span class="blog-date">📅 {{ post.date.string }}</span>
@@ -16,7 +16,7 @@
1616
<a
1717
v-for="resolvedTag in resolvedTags.slice(0, 5)"
1818
:key="resolvedTag.slug"
19-
:href="resolvedTag.url"
19+
:href="withBase(resolvedTag.url)"
2020
:class="['blog-tag', resolvedTag.type]"
2121
>
2222
{{ resolvedTag.title }}
@@ -29,6 +29,7 @@
2929
import { computed } from 'vue';
3030
import type { BlogPost } from '@/core/data-loaders/blog.data';
3131
import { resolveTags } from '@/core/utils';
32+
import { withBase } from 'vitepress';
3233
3334
interface Props {
3435
post: BlogPost;

docs/.vitepress/theme/components/blog/BlogPostMeta.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<a
1717
v-for="resolvedTag in resolvedTags"
1818
:key="resolvedTag.slug"
19-
:href="resolvedTag.url"
19+
:href="withBase(resolvedTag.url)"
2020
:class="['tag', resolvedTag.type]"
2121
>
2222
{{ resolvedTag.title }}
@@ -30,6 +30,7 @@
3030
import { useData } from 'vitepress';
3131
import { computed } from 'vue';
3232
import { resolveTags } from '@/core/utils/tagResolver';
33+
import { withBase } from 'vitepress';
3334
3435
const { frontmatter } = useData();
3536

docs/.vitepress/theme/components/categories/CategoryGrid.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
<template>
22
<div class="category-grid">
3-
<a v-for="category in categories" :key="category.slug" :href="`/categories/${category.slug}`" class="category-card">
3+
<a
4+
v-for="category in categories"
5+
:key="category.slug"
6+
:href="withBase(`/categories/${category.slug}`)"
7+
class="category-card"
8+
>
49
<span class="category-badge">{{ category.count }}</span>
510
<span class="category-icon">{{ category.icon }}</span>
611
<h3 class="category-title">{{ category.title }}</h3>
@@ -13,6 +18,7 @@
1318
import { computed } from 'vue';
1419
import { data as tools } from '@/core/data-loaders/tools.data';
1520
import { CATEGORIES } from '@/core/metadata/categories';
21+
import { withBase } from 'vitepress';
1622
1723
interface Props {
1824
sortByCount?: boolean;

docs/.vitepress/theme/components/categories/RelatedCategories.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div v-if="relatedCategories.length > 0">
33
<ul>
44
<li v-for="category in relatedCategories" :key="category.slug">
5-
<a :href="`./${category.slug}`">{{ category.title }}</a>
5+
<a :href="withBase(`./${category.slug}`)">{{ category.title }}</a>
66
</li>
77
</ul>
88
</div>
@@ -13,6 +13,7 @@
1313
import { computed } from 'vue';
1414
import { useRoute } from 'vitepress';
1515
import { getCategoryBySlug } from '@/core/metadata/categories';
16+
import { withBase } from 'vitepress';
1617
1718
const route = useRoute();
1819

docs/.vitepress/theme/components/standards/StandardsGrid.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<a
44
v-for="standard in standards"
55
:key="standard.slug"
6-
:href="`/standards/${standard.slug}`"
6+
:href="withBase(`/standards/${standard.slug}`)"
77
class="category-card standard-card"
88
>
99
<span class="category-badge">{{ standard.count }}</span>
@@ -18,6 +18,7 @@
1818
import { computed } from 'vue';
1919
import { data as tools } from '@/core/data-loaders/tools.data';
2020
import { getStandardMetadata } from '@/core/metadata/standards';
21+
import { withBase } from 'vitepress';
2122
2223
interface Props {
2324
sortByCount?: boolean;

docs/.vitepress/theme/components/tools/ToolCard.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{{ statusEmoji }} {{ statusLabel }}
66
</div>
77
<h3 class="tool-card-title">
8-
<a :href="`/tools/${tool.slug}`">{{ tool.title }}</a>
8+
<a :href="withBase(`/tools/${tool.slug}`)">{{ tool.title }}</a>
99
</h3>
1010
<p v-if="subtitle" class="tool-card-subtitle">{{ subtitle }}</p>
1111
</div>
@@ -23,14 +23,15 @@
2323
<a v-if="tool.website" :href="tool.website" target="_blank" class="tool-link"> Website </a>
2424
<a v-if="tool.repository" :href="tool.repository" target="_blank" class="tool-link"> Repository </a>
2525
<a v-if="tool.documentation" :href="tool.documentation" target="_blank" class="tool-link"> Documentation </a>
26-
<a :href="`/tools/${tool.slug}`" class="tool-link">Details</a>
26+
<a :href="withBase(`/tools/${tool.slug}`)" class="tool-link">Details</a>
2727
</div>
2828
</div>
2929
</template>
3030

3131
<script setup lang="ts">
3232
import { computed } from 'vue';
3333
import type { Tool } from '@/core/data-loaders/tools.data';
34+
import { withBase } from 'vitepress';
3435
3536
interface Props {
3637
tool: Tool;

docs/.vitepress/theme/components/tools/ToolMetadata.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
<li v-if="resolvedCategories.length > 0">
66
<strong>Categories</strong>:
77
<template v-for="(category, index) in resolvedCategories" :key="category.slug">
8-
<a :href="category.url">{{ category.title }}</a>
8+
<a :href="withBase(category.url)">{{ category.title }}</a>
99
<span v-if="index < resolvedCategories.length - 1">, </span>
1010
</template>
1111
</li>
1212
<li v-if="resolvedStandards.length > 0">
1313
<strong>Standards</strong>:
1414
<template v-for="(standard, index) in resolvedStandards" :key="standard.slug">
15-
<a :href="standard.url">{{ standard.title }}</a>
15+
<a :href="withBase(standard.url)">{{ standard.title }}</a>
1616
<span v-if="index < resolvedStandards.length - 1">, </span>
1717
</template>
1818
</li>
@@ -92,6 +92,7 @@ import { computed } from 'vue';
9292
import { useData } from 'vitepress';
9393
import { getCategoryBySlug } from '@/core/metadata/categories';
9494
import { data as standardsData } from '@/core/data-loaders/standards.data';
95+
import { withBase } from 'vitepress';
9596
9697
const { frontmatter } = useData();
9798

docs/standards/[standard].md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<script setup>
66
// This import ensures VitePress watches standards.yaml for changes
77
import { data as _standardsData } from '../.vitepress/core/data-loaders/standards.data'
8+
import { withBase } from 'vitepress'
89
</script>
910

1011
# {{ $params.standardName }}
@@ -37,7 +38,7 @@ import { data as _standardsData } from '../.vitepress/core/data-loaders/standard
3738

3839
<ul>
3940
<li v-for="related in $params.details.related_standards_with_titles" :key="related.slug">
40-
<a :href="`/standards/${related.slug}`">{{ related.title }}</a>
41+
<a :href="withBase(`/standards/${related.slug}`)">{{ related.title }}</a>
4142
</li>
4243
</ul>
4344

0 commit comments

Comments
 (0)