You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I have a website with ssr. On each +page.svelte I have a . On dev it's working fine. If I build and run on prod - I have duplicated tags
This is is how every +page.svelte looks like:
import {LL, locale} from "./../i18n/i18n-svelte"
<<<< body>>>>
<MetaTags
title="{$LL.pageTitle.main()}"
description="{$LL.pageDescription.main()}"
languageAlternates="{getHeadLinks($page.url.pathname, $locale).alternate}"
canonical="{`https://mywebsite.com/${$locale}${removeLocaleFromPath(
$page.url.pathname,
$locale
)}`}"
/>
** FUNCTIONS**
let LOCALES = ["de", "en"]; // IMPORANT ADD NEW LANG
export const getHeadLinks = (url: string, locale: string) => {
url = removeLocaleFromPath(url, locale);
let alternate = [
{ hrefLang: "x-default", href: `https://mywebsite.com/${url}` },
{ hrefLang: "de", href: `https://mywebsite.com/de${url}` },
{ hrefLang: "en", href: `https://mywebsite.com/en${url}` }
];
return { alternate: alternate };
};
export const removeLocaleFromPath = (path: string, locale: string) => {
for (let i = 0; i < LOCALES.length; i++) {
path = path.replace(`/${LOCALES[i]}/`, "/");
}
for (let i = 0; i < LOCALES.length; i++) {
if (path === `/${LOCALES[i]}`) {
path = "";
}
}
return path;
};
If I run the build with js turned off - there is only one instance of meta tag. Tho if I turn it on - the second one appears. When I goto anotherpage one instance of metatag changes its urls, and the other doesn't. So seems like the metatags injected 2 times - on server side and on client side. How do I turn it off ?
The text was updated successfully, but these errors were encountered:
This may not be a bug in svelte-meta-tags.
I don't know the details, but I think it's a bug in Svelte or SvelteKit, so I suggest you create a bug there.
Describe the bug
I have a website with ssr. On each +page.svelte I have a . On dev it's working fine. If I build and run on prod - I have duplicated tags
This is is how every +page.svelte looks like:
If I run the build with js turned off - there is only one instance of meta tag. Tho if I turn it on - the second one appears. When I goto anotherpage one instance of metatag changes its urls, and the other doesn't. So seems like the metatags injected 2 times - on server side and on client side. How do I turn it off ?
The text was updated successfully, but these errors were encountered: