# astro-default-layout

> Astro plugin for setting default Markdown layouts

Latest version **2.0.2** (published 2023-03-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install astro-default-layout
pnpm add astro-default-layout
yarn add astro-default-layout
bun add astro-default-layout
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.2 |
| Published | 2023-03-05 |
| First published | 2022-10-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Dependencies | 0 |
| Unpacked size | 5.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | EccentricVamp |
| Maintainers | eccentricvamp |

## Links

- npm: https://www.npmjs.com/package/astro-default-layout
- npm.io page: https://npm.io/package/astro-default-layout

## Recent versions

- 2.0.2 (latest) — 2023-03-05
- 2.0.1 — 2022-10-15
- 2.0.0 — 2022-10-15
- 1.0.0 — 2022-10-15

## README

# Astro Default Layout

An unofficial plugin for [Astro](https://astro.build) that sets directory-based default layouts for Markdown pages.

Based on a [comment](https://github.com/withastro/astro/issues/397#issuecomment-1264718819) by [mrinestra](https://github.com/mrienstra).

## Installation

```bash
npm install astro-default-layout
```

## Configuration

Add the plugin to `markdown` options in your `astro.config.ts` file:

```ts
// 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`

---
_Source: https://npm.io/package/astro-default-layout · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
