Skip to content
Discussion options

You must be logged in to vote

I think the cheapest answer is just hardcode the domain prefix in the meta tags. Something like:

<head>
    <!-- Open graph -->
    <meta property="og:image" content="https://mysite.com{{ image }}" />

    <!-- Twitter -->
    <meta name="twitter:image" content="https://mysite.com{{ image }}">
</head>

Sure, would probably be not 100% ideal if you were trying to validate OpenGraph against a local/dev/stage server, but perfectly fine if you're running the production site through a validator.


Or, you could write a custom filter which will add your production domain prefix to a URL path, and then use something like <meta name="twitter:image" content="{{ image | abs_url }}">. Which might look…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by mohammedasker
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants