Skip to content

Commit 75b0a60

Browse files
author
Henrique Almeida
committed
chage replace location to pageTypesToSeo function
1 parent 5116bda commit 75b0a60

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

vtex/utils/legacy.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ export const pageTypesToSeo = (
131131
return null;
132132
}
133133

134+
const regexBadDomain = /casaevideonewio\.myvtex\.com\/|lebiscuit\.myvtex\.com\/|.+\.vtexcommercestable\.com\.br\//;
135+
134136
return {
135137
title: current.title || current.name || "",
136138
description: current.metaTagDescription!,
@@ -139,7 +141,7 @@ export const pageTypesToSeo = (
139141
new URL(
140142
(current.url && current.pageType !== "Collection" &&
141143
current.pageType !== "Brand")
142-
? current.url.replace(/.+\.vtexcommercestable\.com\.br/, "")
144+
? current.url.replace(regexBadDomain, "")
143145
.toLowerCase()
144146
: url,
145147
url,
@@ -154,8 +156,7 @@ function toCanonical(url: URL, page?: number) {
154156
if (typeof page === "number") {
155157
url.searchParams.set("page", `${page}`);
156158
}
157-
const regex = /casaevideonewio\.myvtex\.com\/|lebiscuit\.myvtex\.com\//;
158-
return url.href.replace(regex, "");
159+
return url.href
159160
}
160161

161162
/**

0 commit comments

Comments
 (0)