From 6725ee8ef9eaf436b9801052092b5a579d493edc Mon Sep 17 00:00:00 2001 From: kevinzanzi <69643444+kevinzanzi@users.noreply.github.com> Date: Fri, 8 Mar 2024 17:47:25 -0300 Subject: [PATCH] Removed ads from pagination --- src/pages/en/page/[page].astro | 13 +++++++------ src/pages/page/[page].astro | 13 +++++++------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/pages/en/page/[page].astro b/src/pages/en/page/[page].astro index e5b7da9..cb88258 100644 --- a/src/pages/en/page/[page].astro +++ b/src/pages/en/page/[page].astro @@ -13,11 +13,11 @@ import IconChevronRightDouble from '@components/icons/IconChevronRightDouble.ast import { ARTICLES_PER_PAGE } from '@/articles'; -import adsList from '@/private/ads/adList.json'; +// import adsList from '@/private/ads/adList.json'; export const getStaticPaths = (async ({ paginate }) => { - const { ads } = adsList; - const filtered_ads = ads.filter((ad: any) => ad.lang === 'en'); + // const { ads } = adsList; + // const filtered_ads = ads.filter((ad: any) => ad.lang === 'en'); const allArticles: MarkdownInstance>[] = await Astro.glob( '../../../pages/en/blog/article/*.md', @@ -54,7 +54,7 @@ export const getStaticPaths = (async ({ paginate }) => { } } - let pageArticlesWithAds = filteredArticles; + /*let pageArticlesWithAds = filteredArticles; let idx = weightedRandomSelect(filtered_ads) || 0; if (filtered_ads.length > 0 && filteredArticles.length > 5) { pageArticlesWithAds = filteredArticles.reduce( @@ -111,9 +111,10 @@ export const getStaticPaths = (async ({ paginate }) => { }; pageArticlesWithAds.push(theAd); } - } + }*/ - return paginate(pageArticlesWithAds, { + // return paginate(pageArticlesWithAds, { + return paginate(filteredArticles, { pageSize: total, }); }) satisfies GetStaticPaths; diff --git a/src/pages/page/[page].astro b/src/pages/page/[page].astro index 21f0d5b..78552ff 100644 --- a/src/pages/page/[page].astro +++ b/src/pages/page/[page].astro @@ -13,11 +13,11 @@ import IconChevronRightDouble from '@components/icons/IconChevronRightDouble.ast import { ARTICLES_PER_PAGE } from '@/articles'; -import adsList from '@/private/ads/adList.json'; +// import adsList from '@/private/ads/adList.json'; export const getStaticPaths = (async ({ paginate }) => { - const { ads } = adsList; - const filtered_ads = ads.filter((ad: any) => ad.lang === 'en'); + // const { ads } = adsList; + // const filtered_ads = ads.filter((ad: any) => ad.lang === 'en'); const allArticles: MarkdownInstance>[] = await Astro.glob( '../../pages/blog/article/*.md', @@ -54,7 +54,7 @@ export const getStaticPaths = (async ({ paginate }) => { } } - let pageArticlesWithAds = filteredArticles; + /*let pageArticlesWithAds = filteredArticles; let idx = weightedRandomSelect(filtered_ads) || 0; if (filteredArticles.length > 5) { pageArticlesWithAds = filteredArticles.reduce( @@ -111,9 +111,10 @@ export const getStaticPaths = (async ({ paginate }) => { }; pageArticlesWithAds.push(theAd); } - } + }*/ - return paginate(pageArticlesWithAds, { + // return paginate(pageArticlesWithAds, { + return paginate(filteredArticles, { pageSize: total, }); }) satisfies GetStaticPaths;