mirror of
https://iceshrimp.dev/Crimekillz/jointrashposs.git
synced 2024-11-21 16:33:48 +01:00
fix: canonical urlにクエリが含まれるのを修正
This commit is contained in:
parent
ad07837ad8
commit
f9dac8ba37
11
app.vue
11
app.vue
@ -77,24 +77,25 @@ const head = useLocaleHead({
|
||||
addSeoAttributes: true,
|
||||
});
|
||||
|
||||
const i18nLinks = computed(() => head.value.link?.map((e) => {
|
||||
const i18nLinks = computed(() => head.value.link?.map((e: any) => {
|
||||
if (e.rel === 'alternate') {
|
||||
let href = e.href;
|
||||
const url = parseURL(href);
|
||||
if (typeof e.hreflang === 'string' && (e.hreflang.includes('ja') || e.hreflang === 'x-default') && e.hreflang !== 'ja-KS') {
|
||||
const url = parseURL(href);
|
||||
url.pathname = joinURL('/ja/', url.pathname);
|
||||
href = cleanDoubleSlashes(withTrailingSlash(stringifyParsedURL(url)));
|
||||
} else {
|
||||
href = cleanDoubleSlashes(withTrailingSlash(href));
|
||||
}
|
||||
url.search = '';
|
||||
href = cleanDoubleSlashes(withTrailingSlash(stringifyParsedURL(url)));
|
||||
return { ...e, rel: e.rel, href, hreflang: e.hreflang };
|
||||
} else if (e.rel === 'canonical' && locale.value === 'ja') {
|
||||
let href = e.href;
|
||||
const url = parseURL(href);
|
||||
url.pathname = joinURL('/ja/', url.pathname);
|
||||
url.search = '';
|
||||
href = cleanDoubleSlashes(withTrailingSlash(stringifyParsedURL(url)));
|
||||
return { ...e, rel: e.rel, href, hreflang: e.hreflang };
|
||||
}
|
||||
|
||||
return e;
|
||||
}));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user