fix: display error messages if building on dev without index page

This commit is contained in:
Araozu 2024-11-21 21:45:03 -05:00
parent a1c076305d
commit fbc8124646
2 changed files with 5 additions and 7 deletions

View File

@ -36,12 +36,6 @@ const { showSidebarButton = true } = Astro.props;
> >
Standard Library Standard Library
</a> </a>
<a
href="/api/help/"
class="hidden sm:inline-block px-4 font-display font-bold-text-xl hover:underline"
>
Help
</a>
<a <a
href="/spec/" href="/spec/"
class="hidden sm:inline-block px-4 font-display font-bold-text-xl hover:underline" class="hidden sm:inline-block px-4 font-display font-bold-text-xl hover:underline"

View File

@ -92,7 +92,11 @@ for (const levels_key in second_level) {
} }
const index_page = entries.find(post => post.relative_file === "/index.md" || post.relative_file === "/index.mdx"); const index_page = entries.find(post => post.relative_file === "/index.md" || post.relative_file === "/index.mdx");
const basePath = index_page.url; if (index_page === undefined && process.env.NODE_ENV !== "production") {
console.error("\n\nBuilding without an index page");
console.error("Props base_dir:", base_dir);
}
const basePath = index_page?.url ?? "/";
--- ---
<BaseLayout title={frontmatter.title}> <BaseLayout title={frontmatter.title}>