1

I want to create asset subfolders by page & by asset type.
I use an asset field in an matrix field for multiple asset types like video, images etc.

In an asset field I can access the slug of an entry by:
{owner.slug}

Is there a way to access a an asset field inside an matrix block to fetch the kind for the asset subfolder? Like

{asset.kind}/{owner.slug}

To create an subfolder like

images/about-us/asset.jpg
1

Assuming the Assets field on your block has a handle of asset, you could do:

{object.asset.one().kind}/{owner.slug}
2
  • I already tried this approch: The Asset field’s Default Asset Location setting has an invalid subpath (“{object.asset.one().kind}/{owner.slug}”).
    – pepe
    Oct 13 at 7:03
  • This works. What's the handle of your Assets field?
    – Oli
    Oct 13 at 8:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.