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: Metadata lost on published sites (#2349)

Ivan Starkovdfab713c2a6c
diff --git a/fixtures/webstudio-custom-template/.webstudio/data.json b/fixtures/webstudio-custom-template/.webstudio/data.json
index 80df7d87f2..15f50a52c9 100644
--- a/fixtures/webstudio-custom-template/.webstudio/data.json
+++ b/fixtures/webstudio-custom-template/.webstudio/data.json
@@ -1,15 +1,17 @@
{
"build": {
- "id": "d1e8a55b-972b-46f9-bcfd-a8b67c4846f6",
+ "id": "de63ff61-f4b6-437e-bbc6-b2d085cd35bd",
"projectId": "0d856812-61d8-4014-a20a-82e01c0eb8ee",
- "version": 1,
- "createdAt": "2023-09-17T07:56:30.814Z",
+ "version": 5,
+ "createdAt": "2023-09-21T09:44:06.958Z",
"pages": {
"homePage": {
"id": "nfzls_SkTc9jKYyxcZ8Lw",
"name": "Home",
"title": "Home",
- "meta": {},
+ "meta": {
+ "description": "Page description f511c297-b44f-4e4b-96bd-d013da06bada"
+ },
"rootInstanceId": "ibXgMoi9_ipHx1gVrvii0",
"path": ""
},
@@ -122,7 +124,9 @@
"id": "nfzls_SkTc9jKYyxcZ8Lw",
"name": "Home",
"title": "Home",
- "meta": {},
+ "meta": {
+ "description": "Page description f511c297-b44f-4e4b-96bd-d013da06bada"
+ },
"rootInstanceId": "ibXgMoi9_ipHx1gVrvii0",
"path": ""
},
@@ -131,7 +135,9 @@
"id": "nfzls_SkTc9jKYyxcZ8Lw",
"name": "Home",
"title": "Home",
- "meta": {},
+ "meta": {
+ "description": "Page description f511c297-b44f-4e4b-96bd-d013da06bada"
+ },
"rootInstanceId": "ibXgMoi9_ipHx1gVrvii0",
"path": ""
}
diff --git a/fixtures/webstudio-custom-template/app/__generated__/_index.tsx b/fixtures/webstudio-custom-template/app/__generated__/_index.tsx
index e8728b0e0b..d5c18e6b38 100644
--- a/fixtures/webstudio-custom-template/app/__generated__/_index.tsx
+++ b/fixtures/webstudio-custom-template/app/__generated__/_index.tsx
@@ -48,7 +48,9 @@ export const pageData: PageData = {
id: "nfzls_SkTc9jKYyxcZ8Lw",
name: "Home",
title: "Home",
- meta: {},
+ meta: {
+ description: "Page description f511c297-b44f-4e4b-96bd-d013da06bada",
+ },
rootInstanceId: "ibXgMoi9_ipHx1gVrvii0",
path: "",
},
@@ -57,7 +59,9 @@ export const pageData: PageData = {
id: "nfzls_SkTc9jKYyxcZ8Lw",
name: "Home",
title: "Home",
- meta: {},
+ meta: {
+ description: "Page description f511c297-b44f-4e4b-96bd-d013da06bada",
+ },
rootInstanceId: "ibXgMoi9_ipHx1gVrvii0",
path: "",
},
diff --git a/fixtures/webstudio-custom-template/app/routes/_index.tsx b/fixtures/webstudio-custom-template/app/routes/_index.tsx
index ea8e762907..48bca9f9e1 100644
--- a/fixtures/webstudio-custom-template/app/routes/_index.tsx
+++ b/fixtures/webstudio-custom-template/app/routes/_index.tsx
@@ -33,7 +33,25 @@ export type PageData = Omit<Data, "build"> & {
export const meta: V2_ServerRuntimeMetaFunction = () => {
const { page } = pageData;
- return [{ title: page?.title || "Webstudio", ...page?.meta }];
+ const metas: ReturnType<V2_ServerRuntimeMetaFunction> = [
+ { title: page?.title || "Webstudio" },
+ ];
+ for (const [name, value] of Object.entries(page?.meta ?? {})) {
+ if (name.startsWith("og:")) {
+ metas.push({
+ property: name,
+ content: value,
+ });
+ continue;
+ }
+
+ metas.push({
+ name,
+ content: value,
+ });
+ }
+
+ return metas;
};
export const links: LinksFunction = () => {
diff --git a/fixtures/webstudio-remix-vercel/app/routes/[_route_with_symbols_]._index.tsx b/fixtures/webstudio-remix-vercel/app/routes/[_route_with_symbols_]._index.tsx
index f7aeff7216..a9ff4f40e3 100644
--- a/fixtures/webstudio-remix-vercel/app/routes/[_route_with_symbols_]._index.tsx
+++ b/fixtures/webstudio-remix-vercel/app/routes/[_route_with_symbols_]._index.tsx
@@ -33,7 +33,25 @@ export type PageData = Omit<Data, "build"> & {
export const meta: V2_ServerRuntimeMetaFunction = () => {
const { page } = pageData;
- return [{ title: page?.title || "Webstudio", ...page?.meta }];
+ const metas: ReturnType<V2_ServerRuntimeMetaFunction> = [
+ { title: page?.title || "Webstudio" },
+ ];
+ for (const [name, value] of Object.entries(page?.meta ?? {})) {
+ if (name.startsWith("og:")) {
+ metas.push({
+ property: name,
+ content: value,
+ });
+ continue;
+ }
+
+ metas.push({
+ name,
+ content: value,
+ });
+ }
+
+ return metas;
};
export const links: LinksFunction = () => {
diff --git a/fixtures/webstudio-remix-vercel/app/routes/[form]._index.tsx b/fixtures/webstudio-remix-vercel/app/routes/[form]._index.tsx
index 794b67bc7f..f3669f93a1 100644
--- a/fixtures/webstudio-remix-vercel/app/routes/[form]._index.tsx
+++ b/fixtures/webstudio-remix-vercel/app/routes/[form]._index.tsx
@@ -33,7 +33,25 @@ export type PageData = Omit<Data, "build"> & {
export const meta: V2_ServerRuntimeMetaFunction = () => {
const { page } = pageData;
- return [{ title: page?.title || "Webstudio", ...page?.meta }];
+ const metas: ReturnType<V2_ServerRuntimeMetaFunction> = [
+ { title: page?.title || "Webstudio" },
+ ];
+ for (const [name, value] of Object.entries(page?.meta ?? {})) {
+ if (name.startsWith("og:")) {
+ metas.push({
+ property: name,
+ content: value,
+ });
+ continue;
+ }
+
+ metas.push({
+ name,
+ content: value,
+ });
+ }
+
+ return metas;
};
export const links: LinksFunction = () => {
diff --git a/fixtures/webstudio-remix-vercel/app/routes/[radix]._index.tsx b/fixtures/webstudio-remix-vercel/app/routes/[radix]._index.tsx
index 3f92afc2d5..44f5a20da9 100644
--- a/fixtures/webstudio-remix-vercel/app/routes/[radix]._index.tsx
+++ b/fixtures/webstudio-remix-vercel/app/routes/[radix]._index.tsx
@@ -33,7 +33,25 @@ export type PageData = Omit<Data, "build"> & {
export const meta: V2_ServerRuntimeMetaFunction = () => {
const { page } = pageData;
- return [{ title: page?.title || "Webstudio", ...page?.meta }];
+ const metas: ReturnType<V2_ServerRuntimeMetaFunction> = [
+ { title: page?.title || "Webstudio" },
+ ];
+ for (const [name, value] of Object.entries(page?.meta ?? {})) {
+ if (name.startsWith("og:")) {
+ metas.push({
+ property: name,
+ content: value,
+ });
+ continue;
+ }
+
+ metas.push({
+ name,
+ content: value,
+ });
+ }
+
+ return metas;
};
export const links: LinksFunction = () => {
diff --git a/fixtures/webstudio-remix-vercel/app/routes/_index.tsx b/fixtures/webstudio-remix-vercel/app/routes/_index.tsx
index ea8e762907..48bca9f9e1 100644
--- a/fixtures/webstudio-remix-vercel/app/routes/_index.tsx
+++ b/fixtures/webstudio-remix-vercel/app/routes/_index.tsx
@@ -33,7 +33,25 @@ export type PageData = Omit<Data, "build"> & {
export const meta: V2_ServerRuntimeMetaFunction = () => {
const { page } = pageData;
- return [{ title: page?.title || "Webstudio", ...page?.meta }];
+ const metas: ReturnType<V2_ServerRuntimeMetaFunction> = [
+ { title: page?.title || "Webstudio" },
+ ];
+ for (const [name, value] of Object.entries(page?.meta ?? {})) {
+ if (name.startsWith("og:")) {
+ metas.push({
+ property: name,
+ content: value,
+ });
+ continue;
+ }
+
+ metas.push({
+ name,
+ content: value,
+ });
+ }
+
+ return metas;
};
export const links: LinksFunction = () => {
diff --git a/packages/cli/templates/route-template.tsx b/packages/cli/templates/route-template.tsx
index 7d1bb8f8fb..02fe81a188 100644
--- a/packages/cli/templates/route-template.tsx
+++ b/packages/cli/templates/route-template.tsx
@@ -33,7 +33,25 @@ export type PageData = Omit<Data, "build"> & {
export const meta: V2_ServerRuntimeMetaFunction = () => {
const { page } = pageData;
- return [{ title: page?.title || "Webstudio", ...page?.meta }];
+ const metas: ReturnType<V2_ServerRuntimeMetaFunction> = [
+ { title: page?.title || "Webstudio" },
+ ];
+ for (const [name, value] of Object.entries(page?.meta ?? {})) {
+ if (name.startsWith("og:")) {
+ metas.push({
+ property: name,
+ content: value,
+ });
+ continue;
+ }
+
+ metas.push({
+ name,
+ content: value,
+ });
+ }
+
+ return metas;
};
export const links: LinksFunction = () => {