feat: remote sitemap

This commit is contained in:
Cory Dransfeldt 2024-10-19 13:43:07 -07:00
parent 193366e946
commit 0275c8f02f
No known key found for this signature in database
7 changed files with 86 additions and 52 deletions

View file

@ -1,19 +0,0 @@
import { createClient } from '@supabase/supabase-js'
const SUPABASE_URL = process.env.SUPABASE_URL
const SUPABASE_KEY = process.env.SUPABASE_KEY
const supabase = createClient(SUPABASE_URL, SUPABASE_KEY)
export default async function fetchSitemap() {
const { data, error } = await supabase
.from('optimized_sitemap')
.select('sitemap')
if (error) {
console.error('Error fetching sitemap data:', error)
return []
}
const [{ sitemap } = {}] = data
return sitemap || []
}

View file

@ -1,16 +0,0 @@
---
permalink: "/sitemap.xml"
layout: null
eleventyExcludeFromCollections: true
---
<?xml version="1.0" encoding="utf-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
{% for page in sitemap -%}
<url>
<loc>{{ page.url }}</loc>
<lastmod>{{ page.date | date: '%Y-%m-%dT%H:%M:%S%:z' }}</lastmod>
<changefreq>monthly</changefreq>
<priority>0.5</priority>
</url>
{% endfor %}
</urlset>