Press n or j to go to the next uncovered block, b, p or k for the previous block.
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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | 2x 7x 4x 2x 7x 4x 3x 2x 2x 2x 5x 5x 4x 3x | import { DefaultSeoProps } from 'next-seo' import { OpenGraphMedia } from 'next-seo/lib/types' import { Router } from 'next/router' export type NextSEORouter = Pick<Router, 'asPath' | 'locale'> export interface LanguageAlternate { hrefLang: string href: string } export const getLanguageAlternates = ( appBaseUri: string, router: NextSEORouter, ): ReadonlyArray<LanguageAlternate> | undefined => { if (!appBaseUri) return return [ { hrefLang: 'en', href: `${appBaseUri}/en${router.asPath}`, }, { hrefLang: 'fr', href: `${appBaseUri}/fr${router.asPath}`, }, ] } export const getOpenGraphImages = ( appBaseUri: string, ): ReadonlyArray<OpenGraphMedia> | undefined => { if (!appBaseUri) return return [ { url: `${appBaseUri}/ogp.jpg`, width: 2048, height: 1152, }, ] } export type GetNextSEOConfig = ( appBaseUri: string, router: NextSEORouter, ) => DefaultSeoProps export const getDefaultConfig: GetNextSEOConfig = (appBaseUri, router) => ({ titleTemplate: '%s - Canada.ca', defaultTitle: "Passport Application Status Checker | Vérificateur de l'état d'une demande de passeport - Canada.ca", additionalMetaTags: [ { name: 'author', content: 'Employment and Social Development Canada', }, { name: 'author', keyOverride: 'author:fr', lang: 'fr', content: 'Emploi et Développement social Canada', }, { name: 'dcterms.accessRights', content: '2' }, { name: 'dcterms.creator', content: 'Employment and Social Development Canada', }, { name: 'dcterms.creator', keyOverride: 'dcterms.creator:fr', lang: 'fr', content: 'Emploi et Développement social Canada', }, { name: 'dcterms.language', content: 'eng' }, { name: 'dcterms.language', keyOverride: 'dcterms.language:fr', lang: 'fr', content: 'fra', }, { name: 'dcterms.service', content: 'ESDC-EDSC_PASC-VEDP' }, { name: 'dcterms.spatial', content: 'Canada' }, { name: 'dcterms.subject', content: 'Travel and Tourism', }, { name: 'dcterms.subject', keyOverride: 'dcterms.subject:fr', lang: 'fr', content: 'Voyage et tourisme', }, ], languageAlternates: getLanguageAlternates(appBaseUri, router), openGraph: { images: getOpenGraphImages(appBaseUri), locale: 'en_CA', siteName: "Passport Application Status Checker | Vérificateur de l'état d'une demande de passeport - Canada.ca", type: 'website', }, twitter: { site: '@CitImmCanada', cardType: 'summary_large_image', }, }) export const getEnglishConfig: GetNextSEOConfig = (appBaseUri, router) => ({ titleTemplate: '%s - Passport Application Status Checker - Canada.ca', defaultTitle: 'Passport Application Status Checker - Canada.ca', additionalMetaTags: [ { name: 'author', content: 'Employment and Social Development Canada', }, { name: 'dcterms.accessRights', content: '2' }, { name: 'dcterms.creator', content: 'Employment and Social Development Canada', }, { name: 'dcterms.language', content: 'eng' }, { name: 'dcterms.service', content: 'ESDC-EDSC_PASC-VEDP' }, { name: 'dcterms.spatial', content: 'Canada' }, { name: 'dcterms.subject', content: 'Travel and Tourism', }, ], languageAlternates: getLanguageAlternates(appBaseUri, router), openGraph: { images: getOpenGraphImages(appBaseUri), locale: 'en_CA', siteName: 'Passport Application Status Checker - Canada.ca', type: 'website', }, twitter: { site: '@CitImmCanada', cardType: 'summary_large_image', }, }) export const getFrenchConfig: GetNextSEOConfig = (appBaseUri, router) => ({ titleTemplate: "%s - Vérificateur de l'état d'une demande de passeport - Canada.ca", defaultTitle: "Vérificateur de l'état d'une demande de passeport - Canada.ca", additionalMetaTags: [ { name: 'author', content: 'Emploi et Développement social Canada', }, { name: 'dcterms.accessRights', content: '2' }, { name: 'dcterms.creator', content: 'Emploi et Développement social Canada', }, { name: 'dcterms.language', content: 'fra' }, { name: 'dcterms.service', content: 'ESDC-EDSC_PASC-VEDP' }, { name: 'dcterms.spatial', content: 'Canada' }, { name: 'dcterms.subject', content: 'Voyage et tourisme', }, ], languageAlternates: getLanguageAlternates(appBaseUri, router), openGraph: { images: getOpenGraphImages(appBaseUri), locale: 'fr_CA', siteName: "Vérificateur de l'état d'une demande de passeport - Canada.ca", type: 'website', }, twitter: { site: '@citimmcanfr', cardType: 'summary_large_image', }, }) export const getNextSEOConfig: GetNextSEOConfig = (appBaseUri, router) => { const { locale } = router if (locale === 'en') return getEnglishConfig(appBaseUri, router) if (locale === 'fr') return getFrenchConfig(appBaseUri, router) return getDefaultConfig(appBaseUri, router) } |