Skip to content

Commit

Permalink
πŸ”οΈ Remove collector and add store tag in sitemap (#1927)
Browse files Browse the repository at this point in the history
* πŸ”οΈ Remove collector and add store tag in sitemap

* πŸ› Fix syntax error in tag id site map

Co-authored-by: Ng Wing Tat, David <[email protected]>

---------

Co-authored-by: Ng Wing Tat, David <[email protected]>
  • Loading branch information
williamchong and nwingt authored Oct 31, 2024
1 parent 6132298 commit 14e9b44
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/config/sitemap.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,24 @@ 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() {
const [
newClassRes,
topClassRes,
creatorRes,
collectorRes,
newBookRes,
cmsBookRes,
] = await Promise.all(
[
getLatestNFTClasses,
getTopNFTClasses,
getTopCreators,
getTopCollectors,
getLatestBooks,
getBookstoreProductsFromCMS,
getBookstoreCMSTags,
].map(url =>
axios.get(url).catch(err => {
// eslint-disable-next-line no-console
Expand All @@ -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}` })),
}));
Expand Down

0 comments on commit 14e9b44

Please sign in to comment.