paulnicoue/composables/useAppHead.js

142 lines
3.9 KiB
JavaScript
Raw Normal View History

2023-01-06 15:46:20 +01:00
export const useAppHead = (pageTitleChunk) => {
// --------------------------------------------------
// DATA
// --------------------------------------------------
2024-12-22 15:58:18 +01:00
const siteTitle = 'Paul Nicoué';
2023-01-06 15:46:20 +01:00
const siteUrl = 'https://paulnicoue.com';
const pageTitle = pageTitleChunk ? `${siteTitle} | ${pageTitleChunk}` : siteTitle;
const pageUrl = siteUrl + useRoute().path;
2024-12-22 15:58:18 +01:00
const metaDescription = `Intégrateur et développeur web.`;
2023-01-06 15:46:20 +01:00
const metaImageUrl = `${siteUrl}/images/paul-nicoue-logo-1200x675px.png`;
// --------------------------------------------------
// HEAD
// --------------------------------------------------
return useHead({
2023-02-14 15:14:16 +01:00
htmlAttrs: {
2025-03-14 11:10:22 +01:00
lang: 'fr',
2023-02-14 15:14:16 +01:00
},
2023-01-06 15:46:20 +01:00
title: pageTitle,
meta: [
/* Basic metadata */
2025-03-14 11:10:22 +01:00
{
charset: 'utf-8',
},
{
name: 'viewport',
content: 'width=device-width',
},
2023-01-06 15:46:20 +01:00
/* Name */
2025-03-14 11:10:22 +01:00
{
id: 'schema_name',
itemprop: 'name',
content: siteTitle,
},
2023-01-06 15:46:20 +01:00
/* Description */
2025-03-14 11:10:22 +01:00
{
name: 'description',
content: metaDescription,
},
{
id: 'schema_description',
itemprop: 'description',
content: metaDescription,
},
2023-01-06 15:46:20 +01:00
/* Author */
2025-03-14 11:10:22 +01:00
{
name: 'author',
content: siteTitle,
},
2023-01-06 15:46:20 +01:00
/* Image */
2025-03-14 11:10:22 +01:00
{
id: 'schema_image',
itemprop: 'image',
content: metaImageUrl,
},
2023-01-06 15:46:20 +01:00
/* Open Graph */
2025-03-14 11:10:22 +01:00
{
property: 'og:title',
content: pageTitle,
},
{
property: 'og:description',
content: metaDescription,
},
{
property: 'og:image',
content: metaImageUrl,
},
{
property: 'og:image:width',
content: '1200',
},
{
property: 'og:image:height',
content: '675',
},
{
property: 'og:url',
content: pageUrl,
},
{
property: 'og:type',
content: 'website',
},
2023-01-06 15:46:20 +01:00
/* Twitter Card */
2025-03-14 11:10:22 +01:00
{
name: 'twitter:card',
content: 'summary_large_image',
},
{
name: 'twitter:title',
content: siteTitle,
},
{
name: 'twitter:description',
content: metaDescription,
},
{
name: 'twitter:image',
content: metaImageUrl,
},
2023-01-06 15:46:20 +01:00
],
link: [
/* Canonical URL */
2025-03-14 11:10:22 +01:00
{
rel: 'canonical',
href: pageUrl,
},
2023-01-06 15:46:20 +01:00
/* Favicon */
2025-03-14 11:10:22 +01:00
{
rel: 'icon',
sizes: 'any',
href: 'favicon/paul-nicoue-favicon.ico',
},
{
rel: 'icon',
type: 'image/svg+xml',
href: 'favicon/paul-nicoue-favicon.svg',
},
{
rel: 'apple-touch-icon',
href: 'favicon/paul-nicoue-apple-touch-icon.png',
},
{
rel: 'manifest',
href: 'favicon/paul-nicoue.webmanifest',
},
2023-01-06 15:46:20 +01:00
],
style: [
/* Schema */
2025-03-14 11:10:22 +01:00
{
itemscope: true,
itemtype: 'https://schema.org/WebSite',
itemref: 'schema_name schema_description schema_image',
},
2023-01-06 15:46:20 +01:00
],
})
}