mirror of
https://iceshrimp.dev/Crimekillz/jointrashposs.git
synced 2024-11-22 00:43:50 +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,
|
addSeoAttributes: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
const i18nLinks = computed(() => head.value.link?.map((e) => {
|
const i18nLinks = computed(() => head.value.link?.map((e: any) => {
|
||||||
if (e.rel === 'alternate') {
|
if (e.rel === 'alternate') {
|
||||||
let href = e.href;
|
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') {
|
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);
|
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 };
|
return { ...e, rel: e.rel, href, hreflang: e.hreflang };
|
||||||
} else if (e.rel === 'canonical' && locale.value === 'ja') {
|
} else if (e.rel === 'canonical' && locale.value === 'ja') {
|
||||||
let href = e.href;
|
let href = e.href;
|
||||||
const url = parseURL(href);
|
const url = parseURL(href);
|
||||||
url.pathname = joinURL('/ja/', url.pathname);
|
url.pathname = joinURL('/ja/', url.pathname);
|
||||||
|
url.search = '';
|
||||||
href = cleanDoubleSlashes(withTrailingSlash(stringifyParsedURL(url)));
|
href = cleanDoubleSlashes(withTrailingSlash(stringifyParsedURL(url)));
|
||||||
return { ...e, rel: e.rel, href, hreflang: e.hreflang };
|
return { ...e, rel: e.rel, href, hreflang: e.hreflang };
|
||||||
}
|
}
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user