Skip to content

Commit

Permalink
feat: update
Browse files Browse the repository at this point in the history
  • Loading branch information
jiazengp committed Sep 1, 2023
1 parent bb7eb20 commit 3587ace
Show file tree
Hide file tree
Showing 9 changed files with 153 additions and 64 deletions.
97 changes: 97 additions & 0 deletions .vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ export default defineConfig({
['meta', { property: 'og:site', content: 'website' }],
['meta', { name: 'twitter:card', content: 'summary_large_image' }],
['meta', { name: 'twitter:creator', content: '@KongyingTavern' }],
['meta', { name: 'twitter:widgets:csp', content: 'on' }],
...(isProd ? productionHead : []),
],
ignoreDeadLinks: [
Expand Down Expand Up @@ -286,6 +287,102 @@ export default defineConfig({
stringify: true,
},
},
transformPageData(pageData, { siteConfig }) {
pageData.frontmatter.head ??= []
pageData.frontmatter.head.push([
'meta',
{
name: 'og:url',
content: `https://yuanshen.site/${
siteConfig.site.base
}${pageData.relativePath.replace('.md', '')}`,
},
])
pageData.frontmatter.head.push([
'meta',
{
name: 'twitter:url',
content: `https://yuanshen.site/${
siteConfig.site.base
}${pageData.relativePath.replace('.md', '')}`,
},
])
pageData.frontmatter.head.push([
'meta',
{
name: 'og:title',
content: pageData.frontmatter.title
? pageData.frontmatter.title
: 'Kongying Tavern',
},
])
pageData.frontmatter.head.push([
'meta',
{
name: 'twitter:title',
content: pageData.frontmatter.title
? pageData.frontmatter.title
: 'Kongying Tavern',
},
])
pageData.frontmatter.head.push([
'meta',
{
name: 'og:description',
content: pageData.frontmatter.description
? pageData.frontmatter.description
: `Genshin Interactive Map
A Completionist's Interactive Map by Kongying Tavern`,
},
])
pageData.frontmatter.head.push([
'meta',
{
name: 'twitter:description',
content: pageData.frontmatter.description
? pageData.frontmatter.description
: `Genshin Interactive Map
A Completionist's Interactive Map by Kongying Tavern`,
},
])
pageData.frontmatter.head.push([
'meta',
{
name: 'description',
content: pageData.frontmatter.description
? pageData.frontmatter.description
: `Genshin Interactive Map
A Completionist's Interactive Map by Kongying Tavern`,
},
])
pageData.frontmatter.head.push([
'meta',
{
name: 'keywords',
content: pageData.frontmatter.keywords
? pageData.frontmatter.keywords
: '空荧酒馆,空荧地图,空荧酒馆原神地图,原神全资源攻略地图,原神攻略地图,原神地图,原神电子地图,原神互动地图,Genshin,Genshin_map,Genshin_Treasure,Genshin Map,Genshin Impact Map,Genshin Impact Interactive Map',
},
])
pageData.frontmatter.head.push([
'meta',
{
name: 'og:image',
content: pageData.frontmatter.image
? pageData.frontmatter.image
: 'https://yuanshen.site/docs/cover.jpg',
},
])
pageData.frontmatter.head.push([
'meta',
{
name: 'twitter:image',
content: pageData.frontmatter.image
? pageData.frontmatter.image
: 'https://yuanshen.site/docs/cover.jpg',
},
])
},
markdown: {
config(md) {
md.use(MarkdownItFootnote)
Expand Down
32 changes: 3 additions & 29 deletions .vitepress/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ export const LOCAL_BASE = 'en'
export const enConfig: LocaleSpecificConfig<
DefaultTheme.Config & CustomConfig
> = {
description: META_DESCRIPTION,
titleTemplate: 'Kongying Tavern',
themeConfig: {
keyword: META_KEYWORDS,
description: META_DESCRIPTION,
image: META_IMAGE,
siteTitle: 'Genshin Interactive Map',
outlineTitle: 'On This Page',
logo: '/imgs/logo_256.png',
Expand Down Expand Up @@ -95,36 +97,8 @@ export const enConfig: LocaleSpecificConfig<
footer: baseHelper(footer(), LOCAL_BASE),
},
head: [
['meta', { name: 'keywords', content: META_KEYWORDS }],
['meta', { property: 'og:url', content: META_URL }],
['meta', { property: 'og:description', content: META_DESCRIPTION }],
['meta', { property: 'twitter:url', content: META_URL }],
['meta', { property: 'twitter:title', content: META_TITLE }],
['meta', { property: 'twitter:description', content: META_DESCRIPTION }],
['meta', { property: 'og:site_name', content: META_TITLE }],
['meta', { property: 'og:locale', content: 'en-US' }],

[
'meta',
{
property: 'og:image',
content: META_IMAGE,
},
],
[
'meta',
{
property: 'og:image',
content: META_IMAGE,
},
],
[
'meta',
{
name: 'twitter:image',
content: META_IMAGE,
},
],
],
}

Expand Down
4 changes: 3 additions & 1 deletion .vitepress/locales/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ export const LOCAL_BASE = 'fr'
export const frConfig: LocaleSpecificConfig<
DefaultTheme.Config & CustomConfig
> = {
description: META_DESCRIPTION,
titleTemplate: 'Kongying Tavern',
themeConfig: {
keyword: META_KEYWORDS,
description: META_DESCRIPTION,
image: META_IMAGE,
siteTitle: 'Carte interactive de Genshin',
outlineTitle: 'Sur cette page',
logo: '/imgs/logo_256.png',
Expand Down
4 changes: 3 additions & 1 deletion .vitepress/locales/ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ export const LOCAL_BASE = 'ja'
export const jaConfig: LocaleSpecificConfig<
DefaultTheme.Config & CustomConfig
> = {
description: META_DESCRIPTION,
titleTemplate: 'Kongying Tavern',
themeConfig: {
keyword: META_KEYWORDS,
description: META_DESCRIPTION,
image: META_IMAGE,
siteTitle: '原神マップ',
outlineTitle: 'このページでは',
logo: '/imgs/logo_256.png',
Expand Down
4 changes: 3 additions & 1 deletion .vitepress/locales/ko.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ export const LOCAL_BASE = 'ko'
export const koConfig: LocaleSpecificConfig<
DefaultTheme.Config & CustomConfig
> = {
description: META_DESCRIPTION,
titleTemplate: 'Kongying Tavern',
themeConfig: {
keyword: META_KEYWORDS,
description: META_DESCRIPTION,
image: META_IMAGE,
siteTitle: 'Genshin Interactive Map',
outlineTitle: 'On This Page',
logo: '/imgs/logo_256.png',
Expand Down
3 changes: 3 additions & 0 deletions .vitepress/locales/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
export interface CustomConfig {
keyword: string
description: string
image: string
footer: {
qrcodeTitle: string
qrcodeMessage: string
Expand Down
32 changes: 4 additions & 28 deletions .vitepress/locales/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,41 +15,17 @@ export const LOCAL_BASE = ''
export const zhConfig: LocaleSpecificConfig<
DefaultTheme.Config & CustomConfig
> = {
description: META_DESCRIPTION,
titleTemplate: '空荧酒馆',
description: '123123',
head: [
['meta', { name: 'keywords', content: META_KEYWORDS }],
['meta', { property: 'og:url', content: META_URL }],
['meta', { property: 'og:description', content: META_DESCRIPTION }],
['meta', { property: 'twitter:url', content: META_URL }],
['meta', { property: 'twitter:title', content: META_TITLE }],
['meta', { property: 'og:site_name', content: META_TITLE }],
['meta', { property: 'twitter:description', content: META_DESCRIPTION }],
['meta', { property: 'og:locale', content: LOCAL_CODE }],
[
'meta',
{
property: 'og:image',
content: META_IMAGE,
},
],
[
'meta',
{
property: 'og:image',
content: META_IMAGE,
},
],
[
'meta',
{
name: 'twitter:image',
content: META_IMAGE,
},
],
],
themeConfig: {
siteTitle: '原神地图',
keyword: META_KEYWORDS,
description: META_DESCRIPTION,
image: META_IMAGE,
outlineTitle: '本页目录',
logo: '/imgs/logo_256.png',
lastUpdatedText: '更新日期',
Expand Down
5 changes: 5 additions & 0 deletions .vitepress/theme/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,10 @@ export default {
initZoom()
}),
)
watchEffect(() => {
if (inBrowser) {
document.cookie = `nf_lang=${lang.value}; expires=Mon, 1 Jan 2024 00:00:00 UTC; path=/`
}
})
},
}
36 changes: 32 additions & 4 deletions src/community.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,42 @@ titleTemplate: 空荧酒馆
:::

<script setup>
import { useUrlSearchParams } from '@vueuse/core'
import { onMounted } from 'vue'
import { isNumber } from '../.vitepress/theme/utils'

const params = useUrlSearchParams('history')
const server = [
{ name: 'Discord', target: '_black', link: 'https://discord.com/invite/aFe57AKZUF', secondary: 'aFe57AKZUF', icon: 'i-logos-discord-icon' },
{ name: '米游社', target: '_black', secondary: 'VBFqyWV', link: 'https://webstatic.miyoushe.com/app/community-villa/toVilla.html?villa_id=3898&mhy_presentation_style=fullscreen', icon: '/imgs/mihoyo-a4504610.png'
{ id: 'discord', name: 'Discord', target: '_black', link: 'https://discord.com/invite/aFe57AKZUF', secondary: 'aFe57AKZUF', icon: 'i-logos-discord-icon' },
{
id: 'mys', name: '米游社', target: '_black', secondary: 'VBFqyWV', link: 'https://webstatic.miyoushe.com/app/community-villa/toVilla.html?villa_id=3898&mhy_presentation_style=fullscreen', icon: '/imgs/mihoyo-a4504610.png'
},
{ name: 'QQ 频道', target: '_black',
secondary: 'f006fek0f', link: 'https://pd.qq.com/s/f006fek0f', icon: '/svg/qq-channel.svg'
{
id: 'qq', name: 'QQ 频道', target: '_black',
secondary: 'f006fek0f', link: 'https://pd.qq.com/s/f006fek0f', icon: '/svg/qq-channel.svg'
},
]

function jump() {
if (Number(params.q) <= document.querySelectorAll('#VPContent > div > div > div.content > div > main > div > div > details:nth-child(6) > ol > li').length) {
let link = document.querySelector(`#VPContent > div > div > div.content > div > main > div > div > details:nth-child(6) > ol > li:nth-child(${Number(params.q)
}) > a`).href
if (link.includes(location.host)) return;
location.href = link
} else {
const target = String(params.q).toLocaleLowerCase()

server.forEach((val) => {
if (val.id === target) {
location.href = val.link
}
})
}
}

onMounted(()=> {
jump()
})
</script>

<style lang="scss" scoped>
Expand Down

0 comments on commit 3587ace

Please sign in to comment.