Twitter Card image meta uses relative URL

Since I began using Discourse, the Twitter Card image meta URL has always used relative URLs for topics with uploaded images. I think Facebook can handle relative image URLs, but Twitter does not seem to like them, so no image is displayed in tweets.

I’ve been working around this by using absolute URLs for images in posts, which worked up until last week. Now, even if the post uses the absolute URL, the image’s relative URL is still used in the Twitter Card image meta tag. Like in this topic, for example.

I’ve tried setting DISCOURSE_CDN_URL, which didn’t seem to affect this tag. DISCOURSE_RELATIVE_URL_ROOT is set because we’re running in a subdir. If I remember correctly, when I tried changing this is to be an absolute URL, it broke the URL structure for many links.

Any idea how to address this?

By posting here as a #bug, and we make a code change to add UrlHelper.absolute to that code :wink:

2 Likes

Any update on this? We still have this bug on our website. :slight_smile:

1 Like

Do we have this issue on our hosted subfolder installs @neil?

I pushed a fix for this. Subfolder bugs begone! :no_entry_sign: :ant: :no_entry_sign:

7 Likes

:raised_hands: You’re the best! We’ve really needed this! :slight_smile:

2 Likes