Hello, I am using the orderings to order the results by first publication date, however this works works in one my components and does not work in the other.
Here is the working one:
const searchValue = query.v;
const currentPage = query.page === 1 ? 1 : query.page;
try {
const postsData = await client.query(
[
Prismic.Predicates.at("document.type", "blog_post"),
Prismic.Predicates.fulltext("document", searchValue),
],
{
orderings: "[my.blog_post.first_publication_date desc]",
pageSize: 12,
page: currentPage,
}
);
return {
props: { postsData, searchValue },
};
} catch (err) {
console.error(err);
}
}
Here is the one that does not work:
export const getStaticProps = async (context) => {
const client = Client();
const postsData = await client.query(
Prismic.Predicates.at("document.type", "blog_post"),
{
orderings: "[my.blog_post.first_publication_date desc]",
pageSize: 10,
}
);
return {
revalidate: 10,
props: { postsData },
};
};