fix: Use origin as provided in HeadSeo. origin would be different for Domain cases (#14935)

* fix: Use origin as provided in HeadSeo. origin would be different for Domain cases

* Add a test

* add more test

* Add tests

* Cleanup tests

* Add an e2e as well

* fix-test

* Reset mocks
This commit is contained in:
Hariom Balhara authored and GitHub committed 2024-05-23 11:47:46 +01:00
1 parent 29ccc58806
commit 5f5cf92456
16 files changed
+730 -27

No files matched your search

@@ -110,9 +110,10 @@ export function subdomainSuffix() {
return urlSplit.length === 3 ? urlSplit.slice(1).join(".") : urlSplit.join(".");
}
export function getOrgFullOrigin(slug: string, options: { protocol: boolean } = { protocol: true }) {
export function getOrgFullOrigin(slug: string | null, options: { protocol: boolean } = { protocol: true }) {
if (!slug)
return options.protocol ? WEBSITE_URL : WEBSITE_URL.replace("https://", "").replace("http://", "");
const orgFullOrigin = `${
options.protocol ? `${new URL(WEBSITE_URL).protocol}//` : ""
}${slug}.${subdomainSuffix()}`;