Skip to content

Commit

Permalink
✨ support set lang
Browse files Browse the repository at this point in the history
  • Loading branch information
XiYang6666 committed Aug 23, 2024
1 parent 387a282 commit 21db0cd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ NUXT_KEYWORDS = ["main page"]
NUXT_IMAGE_HOSTING = false
NUXT_IMAGE_LINKS = []

NUXT_META = [{"name":"test","content","a test meta"}]
NUXT_META = [{"name":"test","content","a test meta"}]
NUXT_LANG = "zh-CN"
9 changes: 4 additions & 5 deletions app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,8 @@
import "@fortawesome/fontawesome-free/css/all.min.css";
const config = useRuntimeConfig();
const ownerName = useState(() => config.ownerName);
const description = useState(() => config.description);
const hitokoto: Ref<string> = useState();
if (process.server) {
Expand All @@ -57,13 +55,11 @@ if (process.server) {
}
const footer = useState(() => config.footer);
const links = useState(() => config.links as Record<string, string>);
const socials = useState(() => config.socials as Record<string, { link: string; icon: string }>);
const keywords = useState(() => config.keywords);
const meta = useState(() => config.meta as Record<string, string>[]);
const lang = useState(() => config.lang);
useHead({
title: config.title,
Expand All @@ -88,5 +84,8 @@ useHead({
as: "image",
},
],
htmlAttrs: {
lang: lang.value,
},
});
</script>
1 change: 1 addition & 0 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ export default defineNuxtConfig({
imageHosting: false,
imageLinks: [],
meta: [],
lang: "zh-CN",
},
});

0 comments on commit 21db0cd

Please sign in to comment.