export const useAppHead = (pageTitleChunk) => {

    // --------------------------------------------------
    // DATA
    // --------------------------------------------------

    const siteTitle = 'Paul Nicoué - Intégrateur et développeur web';
    const siteUrl = 'https://paulnicoue.com';
    const pageTitle = pageTitleChunk ? `${siteTitle} | ${pageTitleChunk}` : siteTitle;
    const pageUrl = siteUrl + useRoute().path;
    const metaDescription = `Intégration web à l'intention des agences de communication digitale. Création de sites internet sur mesure pour les entreprises et associations.`;
    const metaImageUrl = `${siteUrl}/images/paul-nicoue-logo-1200x675px.png`;

    // --------------------------------------------------
    // HEAD
    // --------------------------------------------------

    return useHead({
        htmlAttrs: {
            lang: 'fr'
        },
        title: pageTitle,
        meta: [
            /* Basic metadata */
            {charset: 'utf-8'},
            {name: 'viewport', content: 'width=device-width'},
            /* Name */
            {id: 'schema_name', itemprop: 'name', content: siteTitle},
            /* Description */
            {name: 'description', content: metaDescription},
            {id: 'schema_description', itemprop: 'description', content: metaDescription},
            /* Author */
            {name: 'author', content: siteTitle},
            /* Image */
            {id: 'schema_image', itemprop: 'image', content: metaImageUrl},
            /* Open Graph */
            {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'},
            /* Twitter Card */
            {name: 'twitter:card', content: 'summary_large_image'},
            {name: 'twitter:title', content: siteTitle},
            {name: 'twitter:description', content: metaDescription},
            {name: 'twitter:image', content: metaImageUrl}
        ],
        link: [
            /* Canonical URL */
            {rel: 'canonical', href: pageUrl},
            /* Favicon */
            {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'}
        ],
        style: [
            /* Schema */
            {itemscope: true, itemtype: 'https://schema.org/WebSite', itemref: 'schema_name schema_description schema_image'}
        ],
        script: [
            /* Matomo tracking code */
            {
                children:
                    `var _paq = window._paq = window._paq || [];
                    _paq.push(["disableCookies"]);
                    _paq.push(['trackPageView']);
                    _paq.push(['enableLinkTracking']);
                    (function() {
                        var u="https://matomo.paulnicoue.com/";
                        _paq.push(['setTrackerUrl', u+'matomo.php']);
                        _paq.push(['setSiteId', '4']);
                        var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
                        g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
                    })();`
            }
        ]
    })
}
