import type { StrapiImage } from '#shared/types/blog' /** * Strapi returns media paths relative to its own origin; the browser needs * absolute ones. Remote providers (S3) already return absolute URLs. */ export function useMediaUrl() { const { public: config } = useRuntimeConfig() return (image: StrapiImage | null | undefined): string | null => { if (!image?.url) return null return image.url.startsWith('http') ? image.url : `${config.strapiUrl}${image.url}` } }