so I'm using an asset field for an OG Image. I need to get the full url for this and I've yet to find a clean way to do this. I figured I could just combine siteUrl and the asset url but I have a weird issue with a double slash.

<meta property="og:image" content="{{siteUrl}}{{entry.ogImage.first().url}}/>

This does what I expect except it adds a slash at the end of {{siteUrl}} and the beginning of the asset so my url is bad, leaving me with a double slash. Short of some programatical removal of the slash, is there another way to do this? Why does my siteUrl have that trailing slash? is something wrong there?


Instead of {{siteUrl}}{{entry.ogImage.first().url}}, try {{entry.ogImage.first().getUrl()}}. getUrl() should return the full image path, including host.

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.