feat: amélioration des meta og
This commit is contained in:
parent
2c3519ca47
commit
e940d966e4
1 changed files with 3 additions and 13 deletions
|
|
@ -11,6 +11,8 @@ const defaultProps = {
|
|||
structuredData: SEO.structuredData,
|
||||
};
|
||||
|
||||
const sd = SEO.structuredData;
|
||||
|
||||
// Extract props with default values assigned from defaultProps. Values can be overridden when the component is used.
|
||||
// For example:
|
||||
// <MainLayout title="Custom Title" meta="Custom description." />
|
||||
|
|
@ -31,7 +33,7 @@ const socialImageRes = await getImage({
|
|||
width: 1200,
|
||||
height: 600,
|
||||
});
|
||||
const socialImage = structuredData.image || Astro.url.origin + socialImageRes.src; // Get the full URL of the image (https://stackoverflow.com/a/9858694)
|
||||
const socialImage = (Astro.url.origin + structuredData.image?.src.toString()) || Astro.url.origin + socialImageRes.src; // Get the full URL of the image (https://stackoverflow.com/a/9858694)
|
||||
|
||||
const languages: { [key: string]: string } = {
|
||||
en: "",
|
||||
|
|
@ -48,17 +50,6 @@ function createHref(lang: string, prefix: string, path: string): string {
|
|||
|
||||
const fullPath: string = Astro.url.pathname;
|
||||
|
||||
const alternateLanguageLinks: string = Object.entries(languages)
|
||||
.map(([lang, prefix]: [string, string]) => {
|
||||
const basePath: string =
|
||||
lang === "en" ? fullPath.replace(/^\/fr\//, "/") : fullPath;
|
||||
|
||||
const href: string = createHref(lang, prefix, basePath);
|
||||
|
||||
return `<link rel="alternate" hreflang="${lang}" href="${href}" />`;
|
||||
})
|
||||
.join("\n");
|
||||
|
||||
|
||||
const appleTouchIcon = await getImage({
|
||||
src: faviconSrc,
|
||||
|
|
@ -87,7 +78,6 @@ const appleTouchIcon = await getImage({
|
|||
/>
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
|
||||
<link rel="canonical" href={canonical} />
|
||||
<Fragment set:html={alternateLanguageLinks} />
|
||||
|
||||
<!-- Facebook Meta Tags -->
|
||||
<meta property="og:locale" content="fr_FR" />
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue