Astro is a perfect choice for your content-focused site: blogs, marketing sites, portfolios, and more!
Astro helps you author and present your content. You can write a blog post directly in Astro using Markdown/MDX, or fetch your content from a headless CMS. Astro lets you build a site around your content: you can add a layout to your pages, create an index of posts, and set up an RSS feed to allow readers to subscribe.
Writing ContentSection titled Writing Content
In Astro, you can author your content in a variety of ways:
- In Markdown files (
.mdor alternative extensions), designed to make it easy to write rich text content.
- In MDX (
.mdx) files, which let you include components and dynamic expressions in your document.
- Using a third-party content management system (CMS), then pulling that content into a
- Other options (less commonly used for content-heavy pages) include
Markdown AuthoringSection titled Markdown Authoring
Markdown is a convenient syntax for writing rich text with basic formatting and common elements like headers, lists, and images. Astro has built-in support for Markdown files in your project.
Create and write a new
.md file in your code editor or bring in an existing file written in your favorite Markdown editor. Some online Markdown editors like StackEdit and Dillinger will even allow you to edit and sync your work with your Astro repository stored on GitHub.
📚 Learn more about writing Markdown content in Astro.
MDX AuthoringSection titled MDX Authoring
If you add the MDX integration to your project, you can also write content using
Write and edit
.mdx files directly in your code editor, alongside your project files.
📚 Learn more about using MDX with Astro.
Headless CMS AuthoringSection titled Headless CMS Authoring
Managing content pagesSection titled Managing content pages
Markdown and MDX files that live in your
src/pages directory will automatically generate pages on your site using Astro’s file-based routing, built at a URL corresponding to the post’s file path.
You can also choose to keep your Markdown and MDX files outside of the
src/pages directory, and instead import their content into
If you’re writing your content in a CMS, you can fetch your posts and use dynamic routing to use one
.astro file to generate a route for each post. In Astro’s default static mode, these routes are generated at build time. If you opt-in to SSR mode, you respond to a request at runtime and fetch the content on demand.
Showcasing your contentSection titled Showcasing your content
To build common features to organize and display your content, such as a blog archive or a page for each blog tag, Astro allows you to fetch filenames and metadata from your Markdown and MDX frontmatter and use these to generate page content and routes.
Community IntegrationsSection titled Community Integrations
In addition to the official
@astrojs/mdx integration, there are several third-party community integrations for working with content in your Astro project.