Decap CMS & Astro
هذا المحتوى غير متوفر بلغتك بعد.
Decap CMS (formerly Netlify CMS) is an open-source, Git-based content management system.
Decap allows you to take full advantage of all of Astro’s features, including image optimization and content collections.
Decap adds a route (typically /admin
) to your project that will load a React app to allow authorized users to manage content directly from the deployed website. Decap will commit changes directly to your Astro project’s source repository.
Installing DecapCMS
Section titled Installing DecapCMSThere are two options for adding Decap to Astro:
-
Install Decap via a package manager with the following command:
-
Import the package into a
<script>
tag in your page<body>
Configuration
Section titled Configuration-
Create a static admin folder at
public/admin/
-
Add
config.yml
topublic/admin/
:Directorypublic
Directoryadmin
- config.yml
-
To add support for content collections, configure each schema in
config.yml
. The following example configures ablog
collection, defining alabel
for each entry’s frontmatter property: -
Add the
admin
route for your React app insrc/pages/admin.html
.Directorypublic
Directoryadmin
- config.yml
Directorysrc
Directorypages
- admin.html
-
To enable media uploads to a specific folder via the Decap editor, add an appropriate path:
See the Decap CMS configuration documentation for full instructions and options.
Usage
Section titled UsageNavigate to yoursite.com/admin/
to use the Decap CMS editor.
Authentication
Section titled AuthenticationDecap CMS with Netlify Identity
Section titled Decap CMS with Netlify IdentityDecap CMS was originally developed by Netlify and has first class support for Netlify Identity.
When deploying to Netlify, configure Identity for your project via the Netlify dashboard and include the Netlify Identity Widget on the admin
route of your project. Optionally include the Identity Widget on the homepage of your site if you plan to invite new users via email.
Decap CMS with External OAuth Clients
Section titled Decap CMS with External OAuth ClientsWhen deploying to hosting providers other than Netlify, you must create your own OAuth routes.
In Astro, this can be done with on-demand rendered routes in your project configured with an adapter enabled.
See Decap’s OAuth Docs for a list of compatible community-maintained OAuth clients.
Community Resources
Section titled Community Resources-
Netlify Identity Template: astro-decap-ssg-netlify
-
On-demand rendering OAuth Routes with Astro Template: astro-decap-starter-ssr
-
Blog Post: Author your Astro site’s content with Git-based CMSs by Aftab Alam
-
Youtube Tutorial: Create a Custom Blog with Astro & NetlifyCMS in MINUTES! by Kumail Pirzada
Production Sites
Section titled Production SitesThe following sites use Astro + Decap CMS in production:
- yunielacosta.com by Yuniel Acosta — source code on GitHub (Netlify CMS)
- portfolioris.nl by Joris Hulsbosch – source code on GitHub