statamic / ideas

đŸ’¡Discussions on ideas and feature requests for Statamic
https://statamic.dev
31 stars 1 forks source link

"Allow file renaming" permission #48

Open steveooo1 opened 4 years ago

steveooo1 commented 4 years ago

Hello,

it would be great if there is some option to reference assets not by path (that can be changed if you change the file name) but by a unique ID.

So:

gallery_images:
  - fresh-prince.jpg
  - dj-jazzy-jeff.jpg
  - uncle-carl.jpg

would be:

gallery_images:
  -  d3790225-6eba-4953-a61b-0f1da0a131da
  -  82bc6928-f3bc-42c2-a447-26173297c91a
  -  be57fdea-167b-489a-9df5-857051360007

If you still want to see what the images are, you can have following logic:

gallery_images:
  -  d3790225-6eba-4953-a61b-0f1da0a131da#fresh-prince.jpg
  -  82bc6928-f3bc-42c2-a447-26173297c91a#dj-jazzy-jeff.jpg
  -  be57fdea-167b-489a-9df5-857051360007#uncle-carl.jpg

The optional # after an ID ist just some kind of temporarily label that gets appended for the whole purpose to make it simpler to identify the id. So you could change the part after # and everything still works. Consider this as a kind of small note for this ID that doesn't get updated. So if you rename the file, the Id still works but the text behind the # doesnt get updated.

All this would make renaming files save, because now, when a client renames a file, all the references are wrong and the ID-based system prevents that.

If this isn't possible, then I strongly hope that there will be some specific permission setting to have files renamed. So we at least could disable the renaming option for files for our clients.

jackmcdade commented 4 years ago

We tried this approach in Statamic 2.0 and went through great painstaking lengths to undo it (by popular demand) in 2.5. It was a huge hassle to reference assets by id manually to the point that people were switching to other platforms.

Happy to add the permission though :)

jasonvarga commented 4 years ago

I always sorta wanted to be able to do a find/replace throughout content when you renamed an asset. Maybe we could do that too.

jackmcdade commented 4 years ago

Certainly preferable to bringing the ids back too!

steveooo1 commented 4 years ago

Okay, I understand! I know of the issues with the ID solution...so I get your points.

The permission option would be great and I also thought about a find and replace feature that somehow goes through (all?) files and tries to replace the paths. But this is probably pretty hard to do and if buggy, the universe explodes and time collapses...

I just know from our agency experience with other CMS that we use this asset path rename feature pretty often, because there is some talk SEO wise that a good file name could help with SEO.