The Newsroom → Introducing — Dynamic Asset Folders! → Sep 30th, 2024
Introducing — Dynamic Asset Folders!
Introducing — Dynamic Asset Folders!
Having a content-heavy site with lots resources and assets? Our new dynamic asset folder creation to the rescue!
With Statamic v5.27.0, we've introduced a new feature with photography, gallery, and portfolio sites in mind, but can help enhance the organization of your assets across the board, no matter the type of site.
How Dynamic Asset Folders Work
By enabling this feature on an Assets Field, each entry will automatically create a new sub-folder to store its assets in. You can set it to use the Entry's slug
, id
, or author
field to generate the folder name from.
Now, each blog post in your Collection will store its images and other assets (like PDFs) in an auto-generated folder named after the slug of your blog post. Let's say you're running a wedding photography website. You have a Galleries collection and your latest wedding is a new entry titled Kate and Johnny
, which would (unless you edit it), use the slug would be kate-and-johnny
.
Now, all the photos you upload into your Photos Assets field will be uploaded into /img/galleries/kate-and-johnny/
. If you decide to add more later or deselect some, you don't have to browse through all of your potentially thousands of images to find the right ones, and the changes of uploading two IMG_7337.jpg
files goes down to next to zero.
Instead of having your asset containers being unstructured and cluttered with all kinds of random files, they can now look like this:
This works flawlessly with Statamic's and Laravel's powerful adapter-based filesystem approach. Whether you store your assets locally on the server or use an object storage like AWS S3 or one of its many API-compatible alternatives, this will just work™.
If you're interested in the implementation details, head over to GitHub and the corresponding PR.
Also in the works...
We are also tinkering with a brand new photography-centric Starter Kit that will utilize this feature. We think you're going to love it.
Let Us Know Your Thoughts
Like other features, this one was a community request that got submitted via our statamic/ideas repo. Is there a specific feature you wish were in Statamic? Feel free to open a feature request on the repository. Please make sure to search first to avoid duplicates.
Questions about this feature or anything else Statamic? Hop on our community Discord, and don't forget to subscribe to our newsletter to get updates right into your inbox.