Skip to content

Commit

Permalink
Add author pages to sitemap
Browse files Browse the repository at this point in the history
  • Loading branch information
larsyencken committed Jul 24, 2024
1 parent 75b4f9c commit 7e72252
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions baker/sitemap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { EXPLORERS_ROUTE_FOLDER } from "../explorer/ExplorerConstants.js"
import { ExplorerProgram } from "../explorer/ExplorerProgram.js"
import { getPostsFromSnapshots } from "../db/model/Post.js"
import { calculateDataInsightIndexPageCount } from "../db/model/Gdoc/gdocUtils.js"
import { GdocAuthor } from "../db/model/Gdoc/GdocAuthor.js"

interface SitemapUrl {
loc: string
Expand Down Expand Up @@ -74,6 +75,7 @@ export const makeSitemap = async (
(postrow) => !alreadyPublishedViaGdocsSlugsSet.has(postrow.slug)
)
const gdocPosts = await db.getPublishedGdocPosts(knex)
const authorPages = await GdocAuthor.getPublishedAuthors(knex)

const publishedDataInsights = await db.getPublishedDataInsights(knex)
const dataInsightFeedPageCount = calculateDataInsightIndexPageCount(
Expand Down Expand Up @@ -140,6 +142,12 @@ export const makeSitemap = async (
}))
)
.concat(explorers.flatMap(explorerToSitemapUrl))
.concat(
authorPages.map((a) => ({
loc: urljoin(BAKED_BASE_URL, "team", a.slug),
lastmod: dayjs(a.updatedAt).format("YYYY-MM-DD"),
}))
)

const sitemap = `<?xml version="1.0" encoding="utf-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
Expand Down

0 comments on commit 7e72252

Please sign in to comment.