Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

Fix a bug when link to Home doesn't work on a published site (#1503)

Roman Pominov037d35162cfa
diff --git a/packages/react-sdk/src/app/custom-components/shared/remix-link.tsx b/packages/react-sdk/src/app/custom-components/shared/remix-link.tsx
index 427c0f8d49..e5aef71851 100644
--- a/packages/react-sdk/src/app/custom-components/shared/remix-link.tsx
+++ b/packages/react-sdk/src/app/custom-components/shared/remix-link.tsx
@@ -12,7 +12,7 @@ export const wrapLinkComponent = (BaseLink: LinkComponent) => {
const href = usePropUrl(getInstanceIdFromComponentProps(props), "href");
if (href?.type === "page") {
- let to = href.page.path;
+ let to = href.page.path === "" ? "/" : href.page.path;
if (href.hash !== undefined) {
to += `#${href.hash}`;
}
diff --git a/packages/react-sdk/src/components/link.tsx b/packages/react-sdk/src/components/link.tsx
index 2418af3138..50fed5192f 100644
--- a/packages/react-sdk/src/components/link.tsx
+++ b/packages/react-sdk/src/components/link.tsx
@@ -23,7 +23,7 @@ export const Link = forwardRef<HTMLAnchorElement, Props>((props, ref) => {
switch (href?.type) {
case "page":
- url = href.page.path;
+ url = href.page.path === "" ? "/" : href.page.path;
if (href.hash !== undefined) {
url += `#${href.hash}`;
}