From fc299e58f667efb0d8f028a4a668345eb3f0694b Mon Sep 17 00:00:00 2001 From: William Chong Date: Thu, 31 Oct 2024 17:14:54 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=8D=EF=B8=8F=20Remove=20collector=20an?= =?UTF-8?q?d=20add=20store=20tag=20in=20sitemap?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/config/sitemap.js | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/config/sitemap.js b/src/config/sitemap.js index 84803f583..cd4991e7f 100644 --- a/src/config/sitemap.js +++ b/src/config/sitemap.js @@ -31,6 +31,7 @@ const getTopCreators = `${LIKECOIN_CHAIN_API}/likechain/likenft/v1/creator?ignor const getTopCollectors = `${LIKECOIN_CHAIN_API}/likechain/likenft/v1/collector?ignore_list=${LIKECOIN_NFT_API_WALLET}`; const getLatestBooks = `${LIKE_CO_API}/likernft/book/store/list`; const getBookstoreProductsFromCMS = `${EXTERNAL_HOST}/api/bookstore/products`; +const getBookstoreCMSTags = `${EXTERNAL_HOST}/api/bookstore/tags`; /* actual routes logic */ async function getSitemapRoutes() { @@ -38,7 +39,6 @@ async function getSitemapRoutes() { newClassRes, topClassRes, creatorRes, - collectorRes, newBookRes, cmsBookRes, ] = await Promise.all( @@ -46,9 +46,9 @@ async function getSitemapRoutes() { getLatestNFTClasses, getTopNFTClasses, getTopCreators, - getTopCollectors, getLatestBooks, getBookstoreProductsFromCMS, + getBookstoreCMSTags, ].map(url => axios.get(url).catch(err => { // eslint-disable-next-line no-console @@ -69,13 +69,16 @@ async function getSitemapRoutes() { id => `/nft/class/${id}` ); const creator = ((creatorRes.data || {}).creators || []).map(c => c.account); - const collectors = ((collectorRes.data || {}).collectors || []).map( - c => c.account - ); - const portfolioPageRoutes = [...new Set(creator.concat(collectors))].map( - id => `/${id}` - ); - return nftDetailsPageRoutes.concat(portfolioPageRoutes).map(url => ({ + const portfolioPageRoutes = creator.map(id => `/${id}`); + + const tagIds = (cmsBookRes.data || {}.records || []).map(t => t.id); + const bookstorePageRoutes = tagIds.map(id => `/store?tag=${id}`); + + let allRoutes = []; + allRoutes = allRoutes.concat(bookstorePageRoutes); + allRoutes = allRoutes.concat(nftDetailsPageRoutes); + allRoutes = allRoutes.concat(portfolioPageRoutes); + return allRoutes.map(url => ({ url: `/${locales[0]}${url}`, links: locales.map(lang => ({ lang, url: `/${lang}${url}` })), }));