get build working

This commit is contained in:
0xBoredDev 2024-02-20 16:31:35 -05:00
parent 626f96be87
commit 4b72a16321
3 changed files with 64 additions and 40 deletions

View File

@ -1,8 +1,6 @@
import type { Metadata } from 'next';
import Prose from 'components/prose';
import { getPage } from 'lib/shopify';
import { notFound } from 'next/navigation';
export const runtime = 'edge';
@ -13,29 +11,52 @@ export async function generateMetadata({
}: {
params: { page: string };
}): 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 {
title: page.seo?.title || page.title,
description: page.seo?.description || page.bodySummary,
openGraph: {
publishedTime: page.createdAt,
modifiedTime: page.updatedAt,
type: 'article'
}
title: 'the happy ape',
description: 'joy meets compassion'
// openGraph: {
// publishedTime: page.createdAt,
// modifiedTime: page.updatedAt,
// 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 } }) {
const page = await getPage(params.page);
// const page = await getPage(params.page);
if (!page) return notFound();
// if (!page) return notFound();
if (params) {
}
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} />
<p className="text-sm italic">
{`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',
day: 'numeric'
}).format(new Date(page.updatedAt))}.`}
</p>
</p> */}
</>
);
}

View File

@ -1,4 +1,4 @@
import { getCollections, getPages, getProducts } from 'lib/shopify';
// import { getCollections, getPages, getProducts } from 'lib/shopify';
import { validateEnvironmentVariables } from 'lib/utils';
import { MetadataRoute } from 'next';
@ -19,34 +19,34 @@ export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
lastModified: new Date().toISOString()
}));
const collectionsPromise = getCollections().then((collections) =>
collections.map((collection) => ({
url: `${baseUrl}${collection.path}`,
lastModified: collection.updatedAt
}))
);
// const collectionsPromise = getCollections().then((collections) =>
// collections.map((collection) => ({
// url: `${baseUrl}${collection.path}`,
// lastModified: collection.updatedAt
// }))
// );
const productsPromise = getProducts({}).then((products) =>
products.map((product) => ({
url: `${baseUrl}/product/${product.handle}`,
lastModified: product.updatedAt
}))
);
// const productsPromise = getProducts({}).then((products) =>
// products.map((product) => ({
// url: `${baseUrl}/product/${product.handle}`,
// lastModified: product.updatedAt
// }))
// );
const pagesPromise = getPages().then((pages) =>
pages.map((page) => ({
url: `${baseUrl}/${page.handle}`,
lastModified: page.updatedAt
}))
);
// const pagesPromise = getPages().then((pages) =>
// pages.map((page) => ({
// url: `${baseUrl}/${page.handle}`,
// lastModified: page.updatedAt
// }))
// );
let fetchedRoutes: Route[] = [];
const fetchedRoutes: Route[] = [];
try {
fetchedRoutes = (await Promise.all([collectionsPromise, productsPromise, pagesPromise])).flat();
} catch (error) {
throw JSON.stringify(error, null, 2);
}
// try {
// fetchedRoutes = (await Promise.all([collectionsPromise, productsPromise, pagesPromise])).flat();
// } catch (error) {
// throw JSON.stringify(error, null, 2);
// }
return [...routesMap, ...fetchedRoutes];
}

View File

@ -14,6 +14,9 @@ module.exports = {
}
]
},
experimental: {
missingSuspenseWithCSRBailout: false
},
async redirects() {
return [
{