Replies: 1 comment
-
Noting that this is very similar to the proposal in #553. I’ll close this one in favour of that earlier discussion, but thanks for the detailed write-up, I’m sure stuff could be shared between the two discussions. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Body
Summary
I'm wondering if it's possible to add a command like
hexo new <title>
that automatically creates content through scaffolding templates.Background & Motivation
Obviously, some traditional CMS frameworks such as Hexo and Hugo provide scaffolding functionality. But after searching Astro's documentation and issues, I found that it doesn't seem to have this feature.
In addition, because Astro has a
content.config.ts
file for managing content. So I think it's entirely possible to add a scaffold function todefineCollection()
, and use it to calculate the corresponding default value.Goals
Add an
astro new <collection> <path/to/file>
command to create new content.This feature will be more powerful than typical scaffolds, as Astro's collection supports both content and data, making it also suitable for creating new data files.
Example
Assuming
content.config.ts
is defined as follows:If you run
astro new blog hello-world.md
, it should automatically generatesrc/content/blog/hello-world.md
containing the following content:Beta Was this translation helpful? Give feedback.
All reactions