Homepage
  1. Pages
  2. Markdown pages

Markdown pages

You can create a new markdown page by running the following command in a terminal:

paper make:page /books/value-price-and-profit --layout=Base --markdown

This creates a new page at pages/books/value-price-and-profit.mds.

When to use markdown pages

Markdown pages are useful when you have a lot of similar pages with the same layout, where only the content differs. A classic example is a blog post or article.

URL

The URL of the page is derived from the file name.

pages/books/value-price-and-profit.mds has the path /books/value-price-and-profit

Layout

On markdown pages, it’s required to specify a layout.

The layout is a Stencil component with a <‎slot>element that will be used as a layout. The content from the markdown file will be inserted into the element.

// components/layouts/Base.stencil
<html>
	<head>
		// ...
	</head>
	<body>
		<slot />
	</body>
</html>

On a markdown page, the layout is specified in front matter:

// pages/books/the-civil-war-in-france.mds
---
layout: Base
---

# The Civil War in France

Components

All components and regular HTML elements can be used inside markdown pages. That means you can embed reusable elements like forms, charts or other visual elements in your content:

---
layout: Base
---

# The Civil War in France

This critical examination of the Paris Commune of 1871 highlighted significant aspects of the conflict, its historical context, and its implications for revolutionary movements.

<ImageWithCaption 
	image="/images/the-civil-war-in-france.png" 
	caption="'The Civil War in France' was published in 1871."
/>

Data

It’s possible to define custom data via front matter. This is metadata that is mostly useful when referencing the page in other places, like a loop.

---
layout: Base
title: The Civil War in France
year: 1871
order: 1 
---

# The Civil War in France