Skip to content

Commit

Permalink
simplified sitemap
Browse files Browse the repository at this point in the history
  • Loading branch information
timbenniks committed Jun 15, 2024
1 parent 69b7b68 commit ebf6ea7
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 5 deletions.
4 changes: 4 additions & 0 deletions components/content/articles.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ const smallOrBigClass = computed(() => {

<ContentList :query="query">
<template #default="{ list }">
<pre v-for="article in list" :key="article._path">{{
article._path
}}</pre>

<ul :class="smallOrBigClass">
<li v-for="article in list" :key="article._path" class="mb-4">
<NuxtLink
Expand Down
53 changes: 48 additions & 5 deletions server/routes/sitemap.xml.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,59 @@
import { serverQueryContent } from '#content/server'
import { SitemapStream, streamToPromise } from 'sitemap'

export default defineEventHandler(async (event) => {
// Fetch all documents
const docs = await serverQueryContent(event).find()
const sitemap = new SitemapStream({
hostname: 'https://timbenniks.dev'
})

for (const doc of docs) {
const urls = [
'/',
'/about',
'/writing',
'/livestreams',
'/presskit',
'/alive-and-kicking',
'/speaking',
'/videos',

'/videos/tim',
'/videos/mp',
'/videos/alive-and-kicking',
'/videos/headless-creator',
'/videos/hygraph',
'/videos/live-hygraph',
'/videos/live-uniform',
'/videos/misc-streams',
'/videos/uniform',

'/writing/the-content-graph-is-the-future',
'/writing/what-type-of-content-organization-do-you-need',
'/writing/the-real-deal-about-content-management-buzzword',
'/writing/the-future-of-headless-cms-content-federation-with-graphql',
'/writing/new-job-alert',
'/writing/this-is-headless-20',
'/writing/the-lost-promise-of-headless',
'/writing/level-up-your-collaboration-game-developer-insights-for-winning-with-marketing-pro',
'/writing/how-to-get-your-webcam-to-look-decent-in-a-few-simple-steps',
'/writing/why-i-didnt-run-the-2016-marathon',
'/writing/the-2015-paris-maratho',
'/writing/my-fitness-story',
'/writing/make-the-web-greener-luxury-edition',
'/writing/how-to-dynamically-stream-video',
'/writing/uniform-is-nuxt-3-read',
'/writing/digital-experience-platforms-the-old-versus-the-new',
'/writing/uniform-dxcp-the-what-why-and-how',
'/writing/how-to-sniff-out-the-glue-monster',
'/writing/the-future-of-managing-projects-at-agencie',
'/writing/fast-personalized-pages-with-vercel-edge-middleware-and-uniform',
'/writing/the-move-from-monolithic-to-composable-architectures',
'/writing/mach-versus-monolithic-suites',
'/writing/the-mach-monolith',
'/writing/the-future-of-jamstack-is-composable'
]

for (const doc of urls) {
sitemap.write({
url: doc._path,
url: doc,
changefreq: 'monthly'
})
}
Expand Down

0 comments on commit ebf6ea7

Please sign in to comment.