(temp workaround) build

This commit is contained in:
kakkokari-gtyih 2023-07-14 01:10:25 +09:00
parent 14d050b05d
commit aebc9b6f07
3 changed files with 11 additions and 6 deletions

View File

@ -97,7 +97,9 @@ export default defineNuxtConfig({
prerender: { prerender: {
routes: [ routes: [
"/404.html" "/404.html"
] ],
// 【一時対応】とりあえずビルドできるようにする
failOnError: false,
}, },
plugins: [ plugins: [
'@/server/plugins/appendComment.ts', '@/server/plugins/appendComment.ts',

View File

@ -29,7 +29,9 @@ definePageMeta({
}); });
defineI18nRoute({ defineI18nRoute({
locales: (locales.value as LocaleObject[]).map((e) => e.code), //locales: (locales.value as LocaleObject[]).map((e) => e.code),
//
locales: ['ja'],
}); });
const route = useRoute(); const route = useRoute();
@ -38,6 +40,10 @@ const slugs = (route.params.slug as string[]).filter((v) => v !== '');
const { data } = await useAsyncData(`blog-${locale.value}-${slugs.join('-')}`, () => queryContent(`/${locale.value}/docs/${slugs.join('/')}`).findOne()); const { data } = await useAsyncData(`blog-${locale.value}-${slugs.join('-')}`, () => queryContent(`/${locale.value}/docs/${slugs.join('/')}`).findOne());
const { navigation } = await useAsyncData('navigation', () => fetchContentNavigation()); const { navigation } = await useAsyncData('navigation', () => fetchContentNavigation());
if (!data.value) {
throw createError({ statusCode: 404, statusMessage: 'page not found' });
}
route.meta.title = data.value?.title; route.meta.title = data.value?.title;
</script> </script>

View File

@ -5,15 +5,12 @@ import { Readable } from 'stream';
import { writeFileSync } from 'fs'; import { writeFileSync } from 'fs';
import path from 'path'; import path from 'path';
// サイトドメインを指定(最後スラッシュ不要)
//const domain = useRuntimeConfig().public.baseUrl;
const domain = "your-app.com";
export default async function genSitemap(nitro: Nitro) { export default async function genSitemap(nitro: Nitro) {
if (!nitro._prerenderedRoutes) { if (!nitro._prerenderedRoutes) {
return; return;
} }
const domain = nitro.options.runtimeConfig.public.baseUrl;
const publicDir = nitro.options.output.publicDir; const publicDir = nitro.options.output.publicDir;
const routes = nitro._prerenderedRoutes?.map((e) => e.fileName || null).filter((e, i, a) => e && a.indexOf(e) === i && e.endsWith("index.html")).map((e) => { const routes = nitro._prerenderedRoutes?.map((e) => e.fileName || null).filter((e, i, a) => e && a.indexOf(e) === i && e.endsWith("index.html")).map((e) => {