Skip to content

Commit

Permalink
fix: add newly prefixed routes to prerendering
Browse files Browse the repository at this point in the history
  • Loading branch information
maybeanerd committed Sep 15, 2023
1 parent 2135384 commit a993845
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion config/i18n.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { NuxtI18nOptions } from '@nuxtjs/i18n/dist/module';
import { LocaleObject } from '@nuxtjs/i18n/dist/runtime/composables';

const locales: Array<LocaleObject> = [
export const locales: Array<LocaleObject> = [
{
code: 'en',
file: 'en.json',
Expand Down
15 changes: 11 additions & 4 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
import gitCommitInfo from 'git-commit-info';
import { profiles } from './server/profiles';
import { i18n } from './config/i18n';
import { i18n, locales } from './config/i18n';

const routesToPrerender: Array<string> = [];
profiles.forEach((profile) => {
locales.forEach((locale) => {
routesToPrerender.push(
`/${locale.code}/${profile.person.name.first.toLowerCase()}`,
);
});
});

// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
Expand All @@ -16,9 +25,7 @@ export default defineNuxtConfig({
nitro: {
prerender: {
crawlLinks: true,
routes: profiles.map(
profile => `/${profile.person.name.first.toLowerCase()}`,
),
routes: routesToPrerender,
},
},
runtimeConfig: {
Expand Down

0 comments on commit a993845

Please sign in to comment.