-
-
Notifications
You must be signed in to change notification settings - Fork 705
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Is your feature request related to a problem? Please describe
In Content Studio Preview, media paths only work correctly when returned directly from Content composables.
If a media path is dynamically built (e.g. ${p.path}/thumbnail.jpg
), the URL is not rewritten/proxied in Preview, so the image does not load, even though it works fine in production.
Describe the solution you'd like
Introduce a composable useMediaPath(path)
that resolves a media path to the correct URL depending on the context:
- In Preview: return a proxied/rewritten URL so the asset loads.
- Outside Preview: returns the path param.
Example usage:
const { data: posts } = await useAsyncData(
'posts',
() => queryCollection('blog').order('date', 'DESC').all(),
{
transform: (posts) => posts.map((p) => {
p.image = useMediaPath(`${p.path}/thumbnail.jpg`)
p.to = p.path
return p
})
}
)
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request