This repository has been archived by the owner on Feb 10, 2025. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathheadHelper.js
42 lines (39 loc) · 1.58 KB
/
headHelper.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/**
* Will generate meta tags for a page from title, description and keywords
*
* @param context
* @param proprieties
*/
export function generateMetas(context, proprieties) {
let defaults = {
type: 'website',
image: 'https://static.retrobox.tech/img/logo/logo_alone_square.png',
keywords: 'retrobox, retro, box, thingmill, valentin derouet, etienne chevrollier, matthieu bessat, raspberry pi zero, diy, kit, rpi, rétrobox',
author: 'Thingmill',
copyright: '© 2020 Thingmill',
url: 'https://retrobox.tech' + context.$nuxt.$route.path
}
proprieties = {...proprieties, ...defaults}
return {
title: proprieties.title,
meta: [
{name: 'description', content: proprieties.description}, //150 - 230 characters
{name: 'keywords', content: proprieties.keywords},
{name: 'author', content: proprieties.author},
{name: 'copyright', content: proprieties.copyright},
// opengraph
{property: 'og:title', content: proprieties.title},
{property: 'og:description', content: proprieties.description},
{property: 'og:type', content: proprieties.type},
{property: 'og:url', content: proprieties.url},
{property: 'og:image', content: proprieties.image},
// twitter
{name: 'twitter:card', content: 'summary'},
{name: 'twitter:title', content: proprieties.title},
{name: 'twitter:url', content: proprieties.url},
{name: 'twitter:image:src', content: proprieties.image},
{name: 'twitter:description', content: proprieties.description},
{name: 'twitter:site', content: '@thingmill'}
]
}
}