StaticJsCMS / static-cms

A Git-based CMS for Static Site Generators
https://staticjscms.netlify.app/
MIT License
596 stars 52 forks source link

Edit filenames in editor #95

Open KaneFreeman opened 1 year ago

KaneFreeman commented 1 year ago

It would be great to edit slugs/filenames within the CMS! Probably the most requested thing from my clients.

Originally posted by @ryangittings in https://github.com/StaticJsCMS/static-cms/discussions/4#discussioncomment-4253686

KaneFreeman commented 1 year ago

This is available in for Nested Collections now (in the upcoming v2.0.0). I will look into extending this to regular folder collections at some point as well.

almereyda commented 1 year ago

Is there a YAML frontmatter convention on how the key for such a slug, an alias to the filename should be called? alias:, or simply slug:?

Then filenames would not need to be edited for a first, blog-focussed approach, and the headline could be changed here.

Implementing to read and write a slug field might be easier to achieve than implementing logic and presentation for a file rename dialog. The original request is ambiguous on what is preferred here.

Considering the default quick starter templates for StaticCMS

we find Hugo, Gatsby and Eleventy (E11y) as static site generators in use with StaticCMS, and Next, Nuxt and Preact as full frameworks for static bundling. While I couldn't figure out where an equivalent of a slug functionality could be found in the Preact documentation, I have found the associated places for the other cases:

Hugo and Gatsby support the slug field:

Eleventy supports a permalink field:

Maybe the name of an eventual slug field to be used could be configurable, to cover both cases above, and at least the last one below?

Nuxt and Next both only support what they call dynamic routes built from slugs derived from file system specification:

Nuxt supports an alias property for additional routes:

For the latter examples, it appears providing the slug via a location in the file system hierarchy is the more generic use case, but providing a slug instead is the more convenient use case.

KaneFreeman commented 1 year ago

This story is specifically about renaming files. Slug fields are completely possible already. I have not decided whether or not to proceed with this story or not yet.