diff --git a/nuxt.config.ts b/nuxt.config.ts index b920387f..41699a82 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -4,6 +4,7 @@ import { defineNuxtConfig } from 'nuxt/config' import { extendViteConfig } from 'nuxt/kit' import { isTest } from 'std-env' import type { HmrOptions } from 'vite' +import { pageMeta } from './modules/shared/page-meta' export default defineNuxtConfig({ modules: [ @@ -158,11 +159,14 @@ export default defineNuxtConfig({ routeRules: { '/admin/**': { prerender: false }, '/api/admin/**': { prerender: false }, - '/api/talks': { swr: 1 }, - '/api/upcoming-conferences': { swr: 1 }, - '/api/uses': { swr: 1 }, - '/api/current-location': { swr: 1 }, - '/uses.md': { swr: 1 }, + ...Object.fromEntries(Object.keys(pageMeta).flatMap(path => [ + [path, { swr: 60 * 60 }], + [path + '.md', { swr: 60 * 60 }], + ])), + '/api/talks': { swr: 60 * 60 }, + '/api/upcoming-conferences': { swr: 60 * 60 }, + '/api/uses': { swr: 60 * 60 }, + '/api/current-location': { swr: 60 * 5 }, '/api/sponsors': { prerender: true }, '/api/hi': { cors: true }, '/feed.xml': { redirect: '/rss.xml' }, diff --git a/server/api/upcoming-conferences.get.ts b/server/api/upcoming-conferences.get.ts index 0ce8ea24..6aff6772 100644 --- a/server/api/upcoming-conferences.get.ts +++ b/server/api/upcoming-conferences.get.ts @@ -4,8 +4,6 @@ import { getUpcomingTalks } from '../utils/cms/talks' import type { UpcomingConference } from '../utils/cms/talks' export default defineEventHandler(async event => { - if (!import.meta.dev && !import.meta.prerender) return [] - const upcomingConferences = await getUpcomingTalks(event) const formatter = new Intl.DateTimeFormat('en', {