Files
web/netlify/functions/sitemap/index.mts
Erik Tiekstra c93381ca80 Merged in feat/SW-550-sitemap (pull request #981)
feat(SW-550): added sync functionality and sitemap generation

* feat(SW-550): added sync functionality and sitemap generation

* feat(SW-550): Added support for splitting and saving multiple sitemaps when there are 50000+ urls

* feat(SW-550): Updates after PR

* feat(SW-550): Added locale to sitemap data

* feat(SW-550): Added support for locale based sitemapData

* feat(SW-550): Saving alternates of sitemap entries

* feat(SW-550): Refactoring to use sitemap utils file

* feat(SW-550): Using Netlify.env to get environment variables

* feat(SW-550): clarify use of functions


Approved-by: Michael Zetterberg
2025-02-17 10:35:11 +00:00

18 lines
599 B
TypeScript

/* eslint-disable import/no-anonymous-default-export */
import type { Context } from "@netlify/functions"
export default async (request: Request, context: Context) => {
const { next_run } = await request.json()
const SITEMAP_SYNC_SECRET = Netlify.env.get("SITEMAP_SYNC_SECRET")
const PUBLIC_URL = Netlify.env.get("PUBLIC_URL")
console.info(
`Started sitemap sync at: ${new Date().toISOString()}! Next invocation at: ${next_run}`
)
const headers = new Headers()
headers.set("x-sitemap-sync-secret", SITEMAP_SYNC_SECRET!)
fetch(`${PUBLIC_URL}/api/sitemap`, {
headers,
})
}