Target image URL in a blog post

Dcode warner asked on April 26, 2017 20:35

Is there a way to get the URL of an image inserted into the blog content. Not the teaser image but any image uploaded by the user. This is to target the first image the post to be used in the facebook og:image.

Correct Answer

Brenden Kehren answered on April 26, 2017 20:51

Use the Head HTML webpart and inject it into the header and set those tags. See this post by Joel

0 votesVote for this answer Unmark Correct answer

Recent Answers


Chetan Sharma answered on April 28, 2017 14:38 (last edited on April 28, 2017 14:39)

Hi Dcode,

Though Brenden has already provided you with an answer I would clarify on one point. FB Open Graph will not pick first image as you said, which is happening in your case. It will randomly pick any image from the available images. It could also be the case that it won't pick any image. This is the case unless you have deliberately provided an OG property for an image or any other properties too.

There is a nice article by David Walsh on this.

You can also use this Lint tool to see how your page will actually look like if someone will share it on FB.

Cheers, Chetan

3 votesVote for this answer Mark as a Correct answer

Dcode warner answered on April 28, 2017 18:21

This is very helpful. Thank you very much.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.