diff --git a/src/content/index.md b/src/content/index.md new file mode 100644 index 0000000..32e0c36 --- /dev/null +++ b/src/content/index.md @@ -0,0 +1,6 @@ +# Welcome +Thank you for choosing this theme! + +If you want to see the posts, check out the [posts](/blog) page. + +If you are site owner, you can manually edit the content of this page by editing the `src/content/index.md` file. \ No newline at end of file diff --git a/src/pages/index.astro b/src/pages/index.astro index 5fc47fd..c130d7a 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -1,15 +1,23 @@ --- import Layout from '../layouts/Layout.astro'; - +// Conditionally import content if file exists +let HomePageContent; +try { + const module = await import('../content/index.md'); + HomePageContent = module.Content; +} catch (e) { + // File doesn't exist or couldn't be imported + console.log('Homepage content not found, using default content'); +} ---

~/

+ {HomePageContent ? :

Welcome!

- - Not much here yet, but you can check out my blog posts here. -
- If you are site owner, please edit src/pages/index.astro to customize this page. +

Not much here yet, but you can check out my blog posts here.

+

If you are site owner, please create src/content/index.md to customize this page.

+ }
\ No newline at end of file