Zum Inhalt springen
This is an unmaintained snapshot of the Astro v4 docs. View the latest docs.

Authoring Content

Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.

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.

In Astro, you can author your content in a variety of ways:

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.

If you add the Astro MDX integration to your project, you can also write content using .mdx files, which can include JavaScript expressions and components within your Markdown. This includes both static Astro components and interactive framework components. This allows you to include UI elements such as a banner or an interactive carousel along with your text content.

Write and edit .mdx files directly in your code editor, alongside your project files. MDX files are a supported page file type in Astro, and may also be used as content collection entries.

Learn more about using MDX with Astro.

Write blog posts in your existing Content Management System (CMS) such as Storyblok, WordPress, or Contentful. Some CMSes, like Storyblok, provide an official Astro integration. Others expose a JavaScript SDK that Astro pages can use to fetch your remote content.

Explore our collection of CMS guides and Astro CMS integrations for a wide selection of resources.

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 .astro pages.

Astro’s own content collections provide a powerful, type-safe way to work with Markdown, MDX, or Markdoc content organized in the src/content/ directory.

You can also fetch markdown remotely from a source outside of your project. This will require your own Markdown parser, or a community integration (e.g. astro-remote).

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 or use content collection helper utilities to query your entries and generate page content and routes.

To publish to a broader audience, create an RSS feed that can be distributed to feed readers.

In addition to the official @astrojs/mdx and @astrojs/markdoc integrations, there are several third-party community integrations for working with content in your Astro project.

Wirke mit

Worum geht es?

Community