feat(seo): removed duplicate keywords and added split title

This commit is contained in:
Corentin Thomasset 2021-05-17 19:56:38 +02:00
parent 4fdc09a787
commit 34800f461d
No known key found for this signature in database
GPG key ID: DBD997E935996158

View file

@ -2,6 +2,7 @@
import {Component, Vue} from 'nuxt-property-decorator' import {Component, Vue} from 'nuxt-property-decorator'
import ToolWrapper from '~/components/ToolWrapper.vue' import ToolWrapper from '~/components/ToolWrapper.vue'
import type {ToolConfig} from '~/types/ToolConfig' import type {ToolConfig} from '~/types/ToolConfig'
@Component({components: {ToolWrapper}}) @Component({components: {ToolWrapper}})
export default class Tool extends Vue { export default class Tool extends Vue {
config(): ToolConfig { config(): ToolConfig {
@ -11,6 +12,8 @@ export default class Tool extends Vue {
public head() { public head() {
const {title, description, keywords} = this.config() const {title, description, keywords} = this.config()
const uniqueKeywords = [...new Set([...keywords, ...title.split(/\s+/)])]
return { return {
title, title,
meta: [ meta: [
@ -21,7 +24,7 @@ export default class Tool extends Vue {
}, },
{ {
name: 'keywords', name: 'keywords',
content: keywords, content: uniqueKeywords,
hid: 'keywords' hid: 'keywords'
} }
] ]