Skip to content

Commit

Permalink
fix(blog): 修复日志更新跳转ID处理
Browse files Browse the repository at this point in the history
  • Loading branch information
boxsnake committed Jan 25, 2025
1 parent 1aec794 commit 490504e
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 14 deletions.
7 changes: 5 additions & 2 deletions .vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import type {
UserConfig,
} from 'vitepress'
import type { CustomConfig } from './locales/types'
import { mapValues } from 'lodash-es'
import { mapKeys, mapValues } from 'lodash-es'

const isProd = process.env.NODE_ENV === 'production'
const productionHead: HeadConfig[] = [
Expand Down Expand Up @@ -389,7 +389,10 @@ export default defineConfig({
allow: ['../..'],
},
},
define: mapValues(env, (value) => JSON.stringify(value)),
define: mapKeys(
mapValues(env, (value) => JSON.stringify(value)),
(key) => `import.meta.env.${key}`,
),
resolve: {
alias: [
{
Expand Down
4 changes: 2 additions & 2 deletions src/en/changelog/web.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ aside: false
---

<script>
if(!import.meta.env.SSR && window)
window.location.href = `../blog/${window.VITE_BLOG_CHANGELOG_WEB_EN_ID}`;
if(!import.meta.env.SSR && window)
window.location.href = `../blog/${import.meta.env.VITE_BLOG_CHANGELOG_WEB_EN_ID}`;
</script>
4 changes: 2 additions & 2 deletions src/en/changelog/windows-client.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ aside: false
---

<script>
if(!import.meta.env.SSR && window)
window.location.href = `../blog/${window.VITE_BLOG_CHANGELOG_WINCLIENT_EN_ID}`;
if(!import.meta.env.SSR && window)
window.location.href = `../blog/${import.meta.env.VITE_BLOG_CHANGELOG_WINCLIENT_EN_ID}`;
</script>
4 changes: 2 additions & 2 deletions src/ja/changelog/web.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ aside: false
---

<script>
if(!import.meta.env.SSR && window)
window.location.href = `../blog/${window.VITE_BLOG_CHANGELOG_WEB_JA_ID}`;
if(!import.meta.env.SSR && window)
window.location.href = `../blog/${import.meta.env.VITE_BLOG_CHANGELOG_WEB_JA_ID}`;
</script>
4 changes: 2 additions & 2 deletions src/ja/changelog/windows-client.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ aside: false
---

<script>
if(!import.meta.env.SSR && window)
window.location.href = `../blog/${window.VITE_BLOG_CHANGELOG_WINCLIENT_JA_ID}`;
if(!import.meta.env.SSR && window)
window.location.href = `../blog/${import.meta.env.VITE_BLOG_CHANGELOG_WINCLIENT_JA_ID}`;
</script>
4 changes: 2 additions & 2 deletions src/zh/changelog/web.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ aside: false
---

<script>
if(!import.meta.env.SSR && window)
window.location.href = `../blog/${window.VITE_BLOG_CHANGELOG_WEB_ZH_ID}`;
if(!import.meta.env.SSR && window)
window.location.href = `../blog/${import.meta.env.VITE_BLOG_CHANGELOG_WEB_ZH_ID}`;
</script>
4 changes: 2 additions & 2 deletions src/zh/changelog/windows-client.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ aside: false
---

<script>
if(!import.meta.env.SSR && window)
window.location.href = `../blog/${window.VITE_BLOG_CHANGELOG_WINCLIENT_ZH_ID}`;
if(!import.meta.env.SSR && window)
window.location.href = `../blog/${import.meta.env.VITE_BLOG_CHANGELOG_WINCLIENT_ZH_ID}`;
</script>

0 comments on commit 490504e

Please sign in to comment.