diff --git a/web/lib/firebase/contracts.ts b/web/lib/firebase/contracts.ts index 453ec697..9fe1e59c 100644 --- a/web/lib/firebase/contracts.ts +++ b/web/lib/firebase/contracts.ts @@ -125,9 +125,10 @@ export async function listTaggedContractsCaseInsensitive( export async function listAllContracts( n: number, - before?: string + before?: string, + sortDescBy = 'createdTime' ): Promise { - let q = query(contracts, orderBy('popularityScore', 'desc'), limit(n)) + let q = query(contracts, orderBy(sortDescBy, 'desc'), limit(n)) if (before != null) { const snap = await getDoc(doc(contracts, before)) q = query(q, startAfter(snap)) diff --git a/web/pages/server-sitemap.xml.tsx b/web/pages/server-sitemap.xml.tsx index 0027c4dc..15cb734c 100644 --- a/web/pages/server-sitemap.xml.tsx +++ b/web/pages/server-sitemap.xml.tsx @@ -4,7 +4,7 @@ import { getServerSideSitemap, ISitemapField } from 'next-sitemap' import { listAllContracts } from 'web/lib/firebase/contracts' export const getServerSideProps: GetServerSideProps = async (ctx) => { - const contracts = await listAllContracts(1000, undefined) + const contracts = await listAllContracts(1000, undefined, 'popularityScore') const score = (popularity: number) => Math.tanh(Math.log10(popularity + 1))