diff --git a/web/pages/server-sitemap.xml.tsx b/web/pages/server-sitemap.xml.tsx index 8625860c..e8f77e58 100644 --- a/web/pages/server-sitemap.xml.tsx +++ b/web/pages/server-sitemap.xml.tsx @@ -1,20 +1,26 @@ +import _ from 'lodash' import { GetServerSideProps } from 'next' -import { getServerSideSitemap } from 'next-sitemap' +import { getServerSideSitemap, ISitemapField } from 'next-sitemap' + import { DOMAIN } from '../../common/envs/constants' +import { LiteMarket } from './api/v0/_types' export const getServerSideProps: GetServerSideProps = async (ctx) => { - // Fetching data from https://docs.manifold.markets/api + // Fetching data from https://manifold.markets/api const response = await fetch(`https://${DOMAIN}/api/v0/markets`) - const liteMarkets = await response.json() - const fields = liteMarkets.map((liteMarket: any) => ({ + const liteMarkets = (await response.json()) as LiteMarket[] + const sortedMarkets = _.sortBy(liteMarkets, (m) => -m.volume24Hours) + + const fields = sortedMarkets.map((market) => ({ // See https://www.sitemaps.org/protocol.html - loc: liteMarket.url, + loc: market.url, changefreq: 'hourly', - priority: 0.2, // Individual markets aren't that important + priority: market.volume24Hours + market.volume7Days > 100 ? 0.7 : 0.1, // TODO: Add `lastmod` aka last modified time - })) - return getServerSideSitemap(ctx, fields) + })) as ISitemapField[] + + return await getServerSideSitemap(ctx, fields) } // Default export to prevent next.js errors diff --git a/web/public/robots.txt b/web/public/robots.txt index 014904fd..adb6e505 100644 --- a/web/public/robots.txt +++ b/web/public/robots.txt @@ -6,5 +6,5 @@ Allow: / Host: https://manifold.markets # Sitemaps -Sitemap: https://manifold.markets/sitemap.xml Sitemap: https://manifold.markets/server-sitemap.xml +Sitemap: https://manifold.markets/sitemap.xml diff --git a/web/public/sitemap-0.xml b/web/public/sitemap-0.xml index 80d0d7e3..6378f587 100644 --- a/web/public/sitemap-0.xml +++ b/web/public/sitemap-0.xml @@ -1,19 +1,6 @@ -https://manifold.marketshourly0.72022-03-24T16:51:19.526Z -https://manifold.markets/abouthourly0.72022-03-24T16:51:19.526Z -https://manifold.markets/accounthourly0.72022-03-24T16:51:19.526Z -https://manifold.markets/add-fundshourly0.72022-03-24T16:51:19.526Z -https://manifold.markets/analyticshourly0.72022-03-24T16:51:19.526Z -https://manifold.markets/createhourly0.72022-03-24T16:51:19.526Z -https://manifold.markets/embed/analyticshourly0.72022-03-24T16:51:19.526Z -https://manifold.markets/foldshourly0.72022-03-24T16:51:19.526Z -https://manifold.markets/homehourly0.72022-03-24T16:51:19.526Z -https://manifold.markets/landing-pagehourly0.72022-03-24T16:51:19.526Z -https://manifold.markets/leaderboardshourly0.72022-03-24T16:51:19.526Z -https://manifold.markets/make-predictionshourly0.72022-03-24T16:51:19.526Z -https://manifold.markets/marketshourly0.72022-03-24T16:51:19.526Z -https://manifold.markets/profilehourly0.72022-03-24T16:51:19.526Z -https://manifold.markets/simulatorhourly0.72022-03-24T16:51:19.526Z -https://manifold.markets/portfoliohourly0.72022-03-24T16:51:19.526Z +https://manifold.marketshourly0.7 +https://manifold.markets/marketshourly0.2 +https://manifold.markets/leaderboardshourly0.2 \ No newline at end of file