Skip to content

Commit

Permalink
fix(core): remove empty index page to prevent blank docs page
Browse files Browse the repository at this point in the history
This removes the empty markdown file that were previously added by
`ensureAstroCollectionNotEmpty` when no index page was specified by
the user. This introduce `default-docs.mdx` as fallback to prevent
blank /docs page. This approach ensures a better UX without redirecting
to the first collection item, as an initial empty project may not have
any items to navigate to.

Closes event-catalog#1130.
  • Loading branch information
carlosallexandre committed Feb 18, 2025
1 parent 831081f commit e20054e
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 332 deletions.
7 changes: 0 additions & 7 deletions default-files-for-collections/pages.md

This file was deleted.

145 changes: 0 additions & 145 deletions eventcatalog/src/components/DocsNavigation.astro

This file was deleted.

131 changes: 0 additions & 131 deletions eventcatalog/src/layouts/CustomDocsPageLayout.astro

This file was deleted.

29 changes: 0 additions & 29 deletions eventcatalog/src/layouts/PlainPage.astro

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import * as path from 'path';
import fs from 'node:fs';
import type { CollectionTypes, PageTypes } from '@types';
import PlainPage from '@layouts/PlainPage.astro';
import { DocumentMinusIcon } from '@heroicons/react/24/outline';
import { buildUrl } from '@utils/url-builder';
import { pageDataLoader } from '@utils/page-loaders/page-data-loader';
Expand Down
24 changes: 24 additions & 0 deletions eventcatalog/src/pages/docs/_default-docs.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# **EventCatalog**

Welcome to [EventCatalog](https://www.eventcatalog.dev/).

This open-source project is designed to help you and your teams bring discoverability and clarity to your event-driven architectures (EDA).

To get started you can read the following guides:

- [Getting started with EventCatalog](https://eventcatalog.dev/docs/development/getting-started/introduction)
- [Creating domains](https://eventcatalog.dev/docs/development/guides/domains/adding-domains)
- [Creating services](https://eventcatalog.dev/docs/development/guides/services/adding-services)
- [Creating commands](https://eventcatalog.dev/docs/development/guides/messages/commands/introduction)
- [Creating events](https://eventcatalog.dev/docs/development/guides/messages/events/introduction)
- [Assigning owners to resources](https://eventcatalog.dev/docs/owners)
- [Using components in your pages (Schemas, OpenAPI, etc)](https://eventcatalog.dev/docs/development/components/using-components)
- [Deploying and hosting your EventCatalog](https://eventcatalog.dev/docs/development/deployment)

### **Join the community**

Got questions about EventCatalog? Feature requests or need support? [Join our community on Discord.](https://discord.gg/3rjaZMmrAm)

### **Enterprise support**

Using EventCatalog and needs enterprise support? Work with us, find out what we offer on our [enterprise page](https://eventcatalog.dev/enterprise).
31 changes: 13 additions & 18 deletions eventcatalog/src/pages/docs/index.astro
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
import Footer from '@layouts/Footer.astro';
import DefaultDocsLandingPage from '@layouts/CustomDocsPageLayout.astro';
import components from '@components/MDX/page-components';
import { getIndexPage } from '@utils/pages';
import VerticalSideBarLayout from '@layouts/VerticalSideBarLayout.astro';
Expand All @@ -11,24 +10,20 @@ let CustomContent = null;
if (page) {
const { Content } = await page.render();
CustomContent = Content;
} else {
CustomContent = await import('./_default-docs.mdx').then((mod) => mod.default);
}
---

{
CustomContent && (
<VerticalSideBarLayout title="EventCatalog">
<main class="flex sm:px-8 docs-layout h-full">
<div class="flex docs-layout w-full">
<div class="w-full lg:mr-2 pr-8 overflow-y-auto py-8">
<div class="prose prose-md w-full !max-w-none">
<CustomContent components={components} />
</div>
<Footer />
</div>
<VerticalSideBarLayout title="EventCatalog">
<main class="flex sm:px-8 docs-layout h-full">
<div class="flex docs-layout w-full">
<div class="w-full lg:mr-2 pr-8 overflow-y-auto py-8">
<div class="prose prose-md w-full !max-w-none">
<CustomContent components={components} />
</div>
</main>
</VerticalSideBarLayout>
)
}

{!CustomContent && <DefaultDocsLandingPage title="EventCatalog" />}
<Footer />
</div>
</div>
</main>
</VerticalSideBarLayout>
Loading

0 comments on commit e20054e

Please sign in to comment.