Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔍️ Remove collector and add store tag in sitemap #1927

Merged
merged 2 commits into from
Oct 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading