mirror of
https://github.com/vercel/commerce.git
synced 2025-05-18 23:46:58 +00:00
try removing getCollections() from sitemap
This commit is contained in:
parent
f8b20cfc99
commit
7dc0f1d34a
@ -1,4 +1,4 @@
|
|||||||
import { getCollections, getPages, getProducts } from 'lib/shopify';
|
import { getPages, getProducts } from 'lib/shopify';
|
||||||
import { validateEnvironmentVariables } from 'lib/utils';
|
import { validateEnvironmentVariables } from 'lib/utils';
|
||||||
import { MetadataRoute } from 'next';
|
import { MetadataRoute } from 'next';
|
||||||
|
|
||||||
@ -19,13 +19,13 @@ 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}`,
|
||||||
@ -43,7 +43,9 @@ export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
|
|||||||
let fetchedRoutes: Route[] = [];
|
let 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);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user