version update & use seo
This commit is contained in:
parent
d142e0c749
commit
4ae315eb88
6 changed files with 37 additions and 16 deletions
|
@ -2,4 +2,5 @@
|
|||
node_modules/
|
||||
.git/
|
||||
.nuxt/
|
||||
.env
|
||||
.env
|
||||
.output/
|
18
app.vue
18
app.vue
|
@ -2,11 +2,25 @@
|
|||
<NuxtPage />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
<script setup lang="ts">
|
||||
import type SEOComponent from "./types/component/seoComponent";
|
||||
import type Global from "./types/single/global";
|
||||
|
||||
const runtimeConfig = useRuntimeConfig();
|
||||
const appTitle = runtimeConfig.public.app.title;
|
||||
|
||||
const { findOne, find } = useStrapi();
|
||||
const { data: global } = await useAsyncData("global", () => findOne<Global>("global"));
|
||||
|
||||
const {
|
||||
metaTitle, metaDescription, keywords,
|
||||
} = global.value?.data?.SEO ?? ({} as SEOComponent);
|
||||
|
||||
useHead({
|
||||
title: appTitle,
|
||||
title: metaTitle ?? appTitle,
|
||||
meta: [
|
||||
{name: "description", content: metaDescription},
|
||||
{name: "keywords", content: keywords},
|
||||
]
|
||||
});
|
||||
</script>
|
||||
|
|
23
package-lock.json
generated
23
package-lock.json
generated
|
@ -1,14 +1,16 @@
|
|||
{
|
||||
"name": "nuxt-app",
|
||||
"version": "1.0.1",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "nuxt-app",
|
||||
"version": "1.0.1",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"@nuxt/image": "^1.8.1",
|
||||
"@nuxtjs/strapi": "npm:@nuxtjs/strapi-edge@1.12.0-28818224.f53bdf9",
|
||||
"@nuxtjs/strapi": "^2.0.0",
|
||||
"nuxt": "^3.13.2",
|
||||
"vue": "latest",
|
||||
"vue-router": "latest"
|
||||
|
@ -17,8 +19,7 @@
|
|||
"autoprefixer": "^10.4.20",
|
||||
"postcss": "^8.4.47",
|
||||
"tailwindcss": "^3.4.14"
|
||||
},
|
||||
"version": "1.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@alloc/quick-lru": {
|
||||
"version": "5.2.0",
|
||||
|
@ -1354,10 +1355,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@nuxtjs/strapi": {
|
||||
"name": "@nuxtjs/strapi-edge",
|
||||
"version": "1.12.0-28818224.f53bdf9",
|
||||
"resolved": "https://registry.npmjs.org/@nuxtjs/strapi-edge/-/strapi-edge-1.12.0-28818224.f53bdf9.tgz",
|
||||
"integrity": "sha512-SdazV9/5qJr/b5F//fveU9DVxBFeYKfB6Gg7wyvZoNUW9z9BSPuQyoCfDdzRkPy+QqdaLhFXPjFJdPNeK/8agA==",
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@nuxtjs/strapi/-/strapi-2.0.0.tgz",
|
||||
"integrity": "sha512-6Q34PQd980ruBTaMzVx23V/GP3YeoqWt9NKxVG79d1TJMwpKHCkFqZEN5jI/2csMyncYuzP4ozt2lIi5JYTudA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@nuxt/kit": "^3.13.2",
|
||||
|
@ -10923,9 +10923,9 @@
|
|||
}
|
||||
},
|
||||
"@nuxtjs/strapi": {
|
||||
"version": "npm:@nuxtjs/strapi-edge@1.12.0-28818224.f53bdf9",
|
||||
"resolved": "https://registry.npmjs.org/@nuxtjs/strapi-edge/-/strapi-edge-1.12.0-28818224.f53bdf9.tgz",
|
||||
"integrity": "sha512-SdazV9/5qJr/b5F//fveU9DVxBFeYKfB6Gg7wyvZoNUW9z9BSPuQyoCfDdzRkPy+QqdaLhFXPjFJdPNeK/8agA==",
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@nuxtjs/strapi/-/strapi-2.0.0.tgz",
|
||||
"integrity": "sha512-6Q34PQd980ruBTaMzVx23V/GP3YeoqWt9NKxVG79d1TJMwpKHCkFqZEN5jI/2csMyncYuzP4ozt2lIi5JYTudA==",
|
||||
"requires": {
|
||||
"@nuxt/kit": "^3.13.2",
|
||||
"defu": "^6.1.4",
|
||||
|
@ -16597,6 +16597,5 @@
|
|||
"readable-stream": "^4.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"version": "1.0.1"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@nuxt/image": "^1.8.1",
|
||||
"@nuxtjs/strapi": "npm:@nuxtjs/strapi-edge@1.12.0-28818224.f53bdf9",
|
||||
"@nuxtjs/strapi": "^2.0.0",
|
||||
"nuxt": "^3.13.2",
|
||||
"vue": "latest",
|
||||
"vue-router": "latest"
|
||||
|
|
5
types/component/seoComponent.ts
Normal file
5
types/component/seoComponent.ts
Normal file
|
@ -0,0 +1,5 @@
|
|||
export default interface SEOComponent {
|
||||
metaTitle: string;
|
||||
metaDescription: string;
|
||||
keywords: string;
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
import type Footer from "../component/globalFooter";
|
||||
import type Navbar from "../component/globalNavbar";
|
||||
import type SEOComponent from "../component/seoComponent";
|
||||
|
||||
export default interface Global {
|
||||
id: number;
|
||||
|
@ -10,4 +11,5 @@ export default interface Global {
|
|||
locale: string;
|
||||
navbar: Navbar;
|
||||
footer: Footer;
|
||||
SEO: SEOComponent;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue