Authoring Content
هذا المحتوى غير متوفر بلغتك بعد.
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 Content
Section titled Writing ContentIn Astro, you can author your content in a variety of ways:
- In Markdown files (
.md
or alternative extensions), designed to make it easy to write rich text content. - In MDX (
.mdx
) or Markdoc (.mdoc
) files with an official integration, which can include components and dynamic expressions in your document. - Using a third-party content management system (CMS), then pulling that content into a
.astro
page. - Other options (less commonly used for content-heavy pages) include
.astro
files and.html
files.
Markdown Authoring
Section titled Markdown AuthoringMarkdown 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.
MDX Authoring
Section titled MDX AuthoringIf 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.
Headless CMS Authoring
Section titled Headless CMS AuthoringWrite 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.
Managing content pages
Section titled Managing content pagesPage files
Section titled Page filesMarkdown 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.
Local content
Section titled Local contentYou can also choose to keep your Markdown and MDX files outside of the src/pages
directory, and instead import their content into .astro
pages.
Content collections
Section titled Content collectionsAstro’s own content collections provide a powerful, type-safe way to work with Markdown, MDX, or Markdoc content organized in the src/content/
directory.
Remote content
Section titled Remote contentYou 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
).
Showcasing your content
Section titled Showcasing your contentTo 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.
Community Integrations
Section titled Community IntegrationsIn 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.