diff --git a/web/lib/firebase/contracts.ts b/web/lib/firebase/contracts.ts index 1f83372e..453ec697 100644 --- a/web/lib/firebase/contracts.ts +++ b/web/lib/firebase/contracts.ts @@ -127,7 +127,7 @@ export async function listAllContracts( n: number, before?: string ): Promise { - let q = query(contracts, orderBy('createdTime', 'desc'), limit(n)) + let q = query(contracts, orderBy('popularityScore', '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 a6673dd4..0027c4dc 100644 --- a/web/pages/server-sitemap.xml.tsx +++ b/web/pages/server-sitemap.xml.tsx @@ -8,12 +8,14 @@ export const getServerSideProps: GetServerSideProps = async (ctx) => { const score = (popularity: number) => Math.tanh(Math.log10(popularity + 1)) - const fields = contracts.map((market) => ({ - loc: `https://manifold.markets/${market.creatorUsername}/${market.slug}`, - changefreq: market.volume24Hours > 10 ? 'hourly' : 'daily', - priority: score(market.popularityScore ?? 0), - lastmod: market.lastUpdatedTime, - })) as ISitemapField[] + const fields = contracts + .sort((x) => x.popularityScore ?? 0) + .map((market) => ({ + loc: `https://manifold.markets/${market.creatorUsername}/${market.slug}`, + changefreq: market.volume24Hours > 10 ? 'hourly' : 'daily', + priority: score(market.popularityScore ?? 0), + lastmod: market.lastUpdatedTime, + })) as ISitemapField[] return await getServerSideSitemap(ctx, fields) }