Replies: 1 comment 2 replies
-
Hey @arnab, You could use a similar logic as the one in your import { BASE_URL } from '@/app/lib/constants'
export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
const db = await load()
const items = await db
.find(
{
collection: 'posts',
status: 'published'
},
['slug', 'publishedAt']
)
.toArray()
return items.map((item) => ({
url: `${BASE_URL}/${item.slug}`,
lastModified: item.publishedAt,
}))
} Let me know if you manage to get it working. Cheers! |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
First, Outstatic looks great, and exactly what I am looking for, to add to my website. Kudos, @avitorio !
How do I go about adding the published posts into my
sitemap
? I already have some pages and have configured Next.js to programatically generate it.Beta Was this translation helpful? Give feedback.
All reactions