-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: don't break when locales are not used fix: make navbar title link to current locale feat: allow customizing locale link in navbar feat: allow overriding theme config feat: support overriding head based on current locale feat: support customizing title and description feat: add lang attribute to html based on route feat: show current and available langs on navbar fix: refactor types to support locales fix: group label customization to theme.translations
- Loading branch information
Showing
29 changed files
with
263 additions
and
339 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,18 @@ | ||
<script setup lang="ts"> | ||
import type { DefaultTheme } from 'vitepress/theme' | ||
import { defineAsyncComponent } from 'vue' | ||
const props = defineProps<{ | ||
carbonAds: DefaultTheme.CarbonAdsOptions | ||
}>() | ||
const VPCarbonAds = __CARBON__ | ||
? defineAsyncComponent(() => import('./VPCarbonAds.vue')) | ||
: () => null | ||
</script> | ||
|
||
<template> | ||
<div class="VPDocAsideCarbonAds"> | ||
<VPCarbonAds /> | ||
<VPCarbonAds :carbonAds="props" /> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 5 additions & 5 deletions
10
src/client/theme-default/components/VPNavBarTranslations.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { computed } from 'vue' | ||
import { useData } from 'vitepress' | ||
import { isExternal } from '../support/utils.js' | ||
|
||
export function useLangs() { | ||
const { site, localeIndex } = useData() | ||
const currentLang = computed(() => ({ | ||
label: site.value.locales[localeIndex.value]?.label, | ||
link: | ||
localeIndex.value === 'root' | ||
? '/' | ||
: site.value.locales[localeIndex.value].link || `/${localeIndex.value}/` | ||
})) | ||
|
||
const localeLinks = computed(() => | ||
Object.entries(site.value.locales).flatMap(([key, value]) => | ||
currentLang.value.label === value.label | ||
? [] | ||
: { | ||
text: value.label, | ||
link: | ||
key === 'root' | ||
? '/' | ||
: isExternal(key) | ||
? key | ||
: value.link || `/${key}/` | ||
} | ||
) | ||
) | ||
|
||
return { localeLinks, currentLang } | ||
} |
Oops, something went wrong.