2.0.2 • Published 1 year ago
astro-default-layout v2.0.2
Astro Default Layout
An unofficial plugin for Astro that sets directory-based default layouts for Markdown pages.
Based on a comment by mrinestra.
Installation
npm install astro-default-layout
Configuration
Add the plugin to markdown
options in your astro.config.ts
file:
// astro.config.ts
import { defineConfig } from "astro/config";
import { defaultLayout } from "astro-default-layout";
export default defineConfig({
markdown: {
remarkPlugins: [defaultLayout],
extendDefaultPlugins: true
}
});
Usage
Main layout
Put your main layout in /src/layouts/MainLayout.astro
Subdirectiories
Layout mapping is directory-based. For example if you want /src/pages/posts/post.astro
to have a different layout, then you should make a new layout in /src/layouts/posts/MainLayout.astro