PronounsPage/hooks/pages-extend.ts
2025-01-16 12:14:40 -08:00

18 lines
568 B
TypeScript

import type { NuxtPage } from 'nuxt/schema';
import type { Config } from '~/locale/config';
export default function extendPages(config: Config): (routes: NuxtPage[]) => void {
return (routes: NuxtPage[]) => {
if (config.nouns.enabled) {
for (const subroute of config.nouns.subroutes || []) {
routes.push({
path: `/${encodeURIComponent(subroute)}`,
name: `nouns-${subroute}`,
file: `~/data/nouns/${subroute}.vue`,
});
}
}
};
}