Glob import in astrojs ! See demo https://its-just-nans.github.io/plugin-astro-content/
Add to your astro.config.mjs
:
import Content from "plugin-astro-content";
export default defineConfig({
vite: {
plugins: [
Content({ objectMode: true }) // change options here
],
},
});
---
import { ContentLoader, ContentLoaderRuntime } from "plugin-astro-content";
const ContentLoaderValue = ContentLoader("../*");
const dynamic = "../*";
const ContentLoaderRuntimeValue = await ContentLoaderRuntime(dynamic);
const ContentLoaderRuntimeValueWithOptions = await ContentLoaderRuntime(dynamic, { objectMode: true }); // dynamic options at runtime
---
<div>{ContentLoaderValue}</div>
<div>{ContentLoaderRuntimeValue}</div>
<div>{ContentLoaderRuntimeValueWithOptions}</div>
Licensed under the MIT License - LICENSE