mirror of
https://github.com/vercel/commerce.git
synced 2025-05-18 23:46:58 +00:00
get build working
This commit is contained in:
parent
626f96be87
commit
4b72a16321
@ -1,8 +1,6 @@
|
|||||||
import type { Metadata } from 'next';
|
import type { Metadata } from 'next';
|
||||||
|
|
||||||
import Prose from 'components/prose';
|
import Prose from 'components/prose';
|
||||||
import { getPage } from 'lib/shopify';
|
|
||||||
import { notFound } from 'next/navigation';
|
|
||||||
|
|
||||||
export const runtime = 'edge';
|
export const runtime = 'edge';
|
||||||
|
|
||||||
@ -13,29 +11,52 @@ export async function generateMetadata({
|
|||||||
}: {
|
}: {
|
||||||
params: { page: string };
|
params: { page: string };
|
||||||
}): Promise<Metadata> {
|
}): Promise<Metadata> {
|
||||||
const page = await getPage(params.page);
|
// const page = await getPage(params.page);
|
||||||
|
|
||||||
if (!page) return notFound();
|
// if (!page) return notFound();
|
||||||
|
if (params) {
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
title: page.seo?.title || page.title,
|
title: 'the happy ape',
|
||||||
description: page.seo?.description || page.bodySummary,
|
description: 'joy meets compassion'
|
||||||
openGraph: {
|
// openGraph: {
|
||||||
publishedTime: page.createdAt,
|
// publishedTime: page.createdAt,
|
||||||
modifiedTime: page.updatedAt,
|
// modifiedTime: page.updatedAt,
|
||||||
type: 'article'
|
// type: 'article'
|
||||||
}
|
// }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// return {
|
||||||
|
// title: page.seo?.title || page.title,
|
||||||
|
// description: page.seo?.description || page.bodySummary,
|
||||||
|
// openGraph: {
|
||||||
|
// publishedTime: page.createdAt,
|
||||||
|
// modifiedTime: page.updatedAt,
|
||||||
|
// type: 'article'
|
||||||
|
// }
|
||||||
|
// };
|
||||||
}
|
}
|
||||||
|
|
||||||
export default async function Page({ params }: { params: { page: string } }) {
|
export default async function Page({ params }: { params: { page: string } }) {
|
||||||
const page = await getPage(params.page);
|
// const page = await getPage(params.page);
|
||||||
|
|
||||||
if (!page) return notFound();
|
// if (!page) return notFound();
|
||||||
|
if (params) {
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<h1 className="mb-8 text-5xl font-bold">{page.title}</h1>
|
<h1 className="mb-8 text-5xl font-bold">the happy ape</h1>
|
||||||
|
<Prose className="mb-8" html="the happy ape" />
|
||||||
|
<p className="text-sm italic">
|
||||||
|
{`This document was last updated on ${new Intl.DateTimeFormat(undefined, {
|
||||||
|
year: 'numeric',
|
||||||
|
month: 'long',
|
||||||
|
day: 'numeric'
|
||||||
|
}).format(new Date())}.`}
|
||||||
|
</p>
|
||||||
|
{/* <h1 className="mb-8 text-5xl font-bold">{page.title}</h1>
|
||||||
<Prose className="mb-8" html={page.body as string} />
|
<Prose className="mb-8" html={page.body as string} />
|
||||||
<p className="text-sm italic">
|
<p className="text-sm italic">
|
||||||
{`This document was last updated on ${new Intl.DateTimeFormat(undefined, {
|
{`This document was last updated on ${new Intl.DateTimeFormat(undefined, {
|
||||||
@ -43,7 +64,7 @@ export default async function Page({ params }: { params: { page: string } }) {
|
|||||||
month: 'long',
|
month: 'long',
|
||||||
day: 'numeric'
|
day: 'numeric'
|
||||||
}).format(new Date(page.updatedAt))}.`}
|
}).format(new Date(page.updatedAt))}.`}
|
||||||
</p>
|
</p> */}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { getCollections, getPages, getProducts } from 'lib/shopify';
|
// import { getCollections, getPages, getProducts } from 'lib/shopify';
|
||||||
import { validateEnvironmentVariables } from 'lib/utils';
|
import { validateEnvironmentVariables } from 'lib/utils';
|
||||||
import { MetadataRoute } from 'next';
|
import { MetadataRoute } from 'next';
|
||||||
|
|
||||||
@ -19,34 +19,34 @@ export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
|
|||||||
lastModified: new Date().toISOString()
|
lastModified: new Date().toISOString()
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const collectionsPromise = getCollections().then((collections) =>
|
// const collectionsPromise = getCollections().then((collections) =>
|
||||||
collections.map((collection) => ({
|
// collections.map((collection) => ({
|
||||||
url: `${baseUrl}${collection.path}`,
|
// url: `${baseUrl}${collection.path}`,
|
||||||
lastModified: collection.updatedAt
|
// lastModified: collection.updatedAt
|
||||||
}))
|
// }))
|
||||||
);
|
// );
|
||||||
|
|
||||||
const productsPromise = getProducts({}).then((products) =>
|
// const productsPromise = getProducts({}).then((products) =>
|
||||||
products.map((product) => ({
|
// products.map((product) => ({
|
||||||
url: `${baseUrl}/product/${product.handle}`,
|
// url: `${baseUrl}/product/${product.handle}`,
|
||||||
lastModified: product.updatedAt
|
// lastModified: product.updatedAt
|
||||||
}))
|
// }))
|
||||||
);
|
// );
|
||||||
|
|
||||||
const pagesPromise = getPages().then((pages) =>
|
// const pagesPromise = getPages().then((pages) =>
|
||||||
pages.map((page) => ({
|
// pages.map((page) => ({
|
||||||
url: `${baseUrl}/${page.handle}`,
|
// url: `${baseUrl}/${page.handle}`,
|
||||||
lastModified: page.updatedAt
|
// lastModified: page.updatedAt
|
||||||
}))
|
// }))
|
||||||
);
|
// );
|
||||||
|
|
||||||
let fetchedRoutes: Route[] = [];
|
const fetchedRoutes: Route[] = [];
|
||||||
|
|
||||||
try {
|
// try {
|
||||||
fetchedRoutes = (await Promise.all([collectionsPromise, productsPromise, pagesPromise])).flat();
|
// fetchedRoutes = (await Promise.all([collectionsPromise, productsPromise, pagesPromise])).flat();
|
||||||
} catch (error) {
|
// } catch (error) {
|
||||||
throw JSON.stringify(error, null, 2);
|
// throw JSON.stringify(error, null, 2);
|
||||||
}
|
// }
|
||||||
|
|
||||||
return [...routesMap, ...fetchedRoutes];
|
return [...routesMap, ...fetchedRoutes];
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,9 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
experimental: {
|
||||||
|
missingSuspenseWithCSRBailout: false
|
||||||
|
},
|
||||||
async redirects() {
|
async redirects() {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user