Skip to content

Commit b6af57c

Browse files
authored
Basic meta tags customization (#29)
* Project wide meta tags * Add page specific description
1 parent aa95a2d commit b6af57c

File tree

4 files changed

+36
-3
lines changed

4 files changed

+36
-3
lines changed

app.vue

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,22 @@
1717
<script setup>
1818
const config = useAppConfig().exactproDocs
1919
20-
useHead({
20+
useSeoMeta({
2121
titleTemplate: (title) => {
2222
if (title) return `${title} | ${config.title}`
2323
return title
24-
}
24+
},
25+
description: config?.seo?.description ?? null,
26+
generator: '@exactpro/docs-web-toolkit'
27+
})
28+
29+
useHead({
30+
meta: [
31+
{
32+
name: 'keywords',
33+
content: config?.seo?.keywords?.join(', ') ?? ''
34+
}
35+
]
2536
})
2637
</script>
2738

components/ep/PageMeta.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ const verificationMetaTags = config.exactproDocs.seo?.verificationMetaTags
2828
<template>
2929
<Head>
3030
<Title>{{ doc ? doc.title : '' }}</Title>
31+
<Meta
32+
v-if="doc && doc.description"
33+
name="description"
34+
:content="doc.description"
35+
/>
3136
<Meta
3237
v-for="(verification, index) of verificationMetaTags"
3338
:key="index"

docs/app.config.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
export default defineAppConfig({
1818
exactproDocs: {
19-
title: 'Docs Template Project',
19+
title: 'Exactpro Docs Toolkit',
2020
github: {
2121
repoLink: 'https://github.com/exactpro/docs-toolkit',
2222
branch: 'master',
@@ -29,6 +29,9 @@ export default defineAppConfig({
2929
},
3030
contacts: [],
3131
seo: {
32+
description:
33+
'Documentation toolkit for Exactpro projects powered by Nuxt.js',
34+
keywords: ['documentation', 'nuxt3', 'nuxt.js', 'vue.js', 'exactpro'],
3235
robots: [{ UserAgent: '*' }, { Allow: '/' }],
3336
sitemap: {
3437
baseUrl: 'https://exactpro.github.io/docs-toolkit'

nuxt.schema.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,20 @@ export default defineNuxtSchema({
7777
docsDir: '/'
7878
},
7979
seo: {
80+
/**
81+
* Description of the documentation. It will be displayed in search results.
82+
* If some page has a description, it will be used instead of this one.
83+
*
84+
* @type {?string}
85+
*/
86+
description: undefined,
87+
/**
88+
* Keywords for the documentation. They will be displayed in search results.
89+
*
90+
* @type {string[]}
91+
* @example ['exactpro', 'documentation', 'nuxt']
92+
*/
93+
keywords: [],
8094
/**
8195
* Configuration for robots.txt
8296
* @see {@link https://github.com/nuxt-modules/robots | Example of configuration}

0 commit comments

Comments
 (0)