diff --git a/lib/v2/epicgames/index.js b/lib/v2/epicgames/index.js index 3a94bb0792..6d746a0c73 100644 --- a/lib/v2/epicgames/index.js +++ b/lib/v2/epicgames/index.js @@ -27,18 +27,25 @@ module.exports = async (ctx) => { dayjs(item.promotions.promotionalOffers[0].promotionalOffers[0].startDate) <= now && dayjs(item.promotions.promotionalOffers[0].promotionalOffers[0].endDate) > now ) - .map((item) => ({ - title: item.title, - author: item.seller.name, - link: `${rootUrl}/${locale}/p/${ - item.catalogNs.mappings.length > 0 ? item.catalogNs.mappings[0].pageSlug : item.offerMappings.length > 0 ? item.offerMappings[0].pageSlug : item.productSlug ? item.productSlug : item.urlSlug - }`, - description: art(path.join(__dirname, 'templates/description.art'), { - description: item.description, - image: item.keyImages[0].url, - }), - pubDate: parseDate(item.promotions.promotionalOffers[0].promotionalOffers[0].startDate), - })); + .map((item) => { + let link = `${rootUrl}/${locale}/p/`; + item.categories.forEach((category) => { + if (category.path === 'bundles') { + link = `${rootUrl}/${locale}/bundles/`; + } + }); + link += item.catalogNs.mappings.length > 0 ? item.catalogNs.mappings[0].pageSlug : item.offerMappings.length > 0 ? item.offerMappings[0].pageSlug : item.productSlug ? item.productSlug : item.urlSlug; + return { + title: item.title, + author: item.seller.name, + link, + description: art(path.join(__dirname, 'templates/description.art'), { + description: item.description, + image: item.keyImages[0].url, + }), + pubDate: parseDate(item.promotions.promotionalOffers[0].promotionalOffers[0].startDate), + }; + }); ctx.state.data = { title: 'Epic Games Store - Free Games',