Skip to content

Commit

Permalink
merge blog and articles
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-rajneeshkumar committed Nov 7, 2024
1 parent 31a1464 commit 5035c81
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion blocks/card-list/card-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,29 @@ const VARIANTS = {
cardRenderer: blogCardRender,

async getData() {
return ffetch('/query-index.json')
let data = [];
const publications = await ffetch('/query-index.json')
.sheet('publications')
.filter((resource) => resource.publicationType === 'Full Article')
.all();

const blogs = await ffetch('/query-index.json')
.sheet('blog')
.all();

data = [...publications, ...blogs];

data.sort((x, y) => {
if (x.date > y.date) {
return -1;
}
if (x.date < y.date) {
return 1;
}
return 0;
});

return data;
},

getCategories(item) {
Expand Down

0 comments on commit 5035c81

Please sign in to comment.