Image to meta property

Alex Koshel asked on March 18, 2021 22:24

Hello. I have field Text type = rich text edition. The field contains a container with content div container <div><img src="/Path/Path/Image.jpg" /></div>

how to transfer a picture to <meta property="og:image" content=""/>?

Correct Answer

Juraj Ondrus answered on March 19, 2021 11:02

In this case it would be much easier to use separate field to upload the image for this purpose - e.g. the image/media selector as suggested.

0 votesVote for this answer Unmark Correct answer

Recent Answers


Jeroen Fürst answered on March 19, 2021 07:57

Hi Alex,

Assuming you are building with the Portal Engine, have you considered changing the field type to a media selector and in the transformation render the meta property with the selected image?

Cheers, Jeroen

0 votesVote for this answer Mark as a Correct answer

Alex Koshel answered on March 19, 2021 09:27

Hi, Field type cannot be change.

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on March 19, 2021 09:59

I would maybe try using custom output filter and change the rendered HTML or custom event handler which will change the saved rich text HTML code. But this sounds to me a bit overkill. What exactly you want to achieve and why?

0 votesVote for this answer Mark as a Correct answer

Alex Koshel answered on March 19, 2021 10:41

I want share page to Twiiter with this page type. And show image like preview

Image Text

0 votesVote for this answer Mark as a Correct answer

Alex Koshel answered on March 19, 2021 10:58 (last edited on March 19, 2021 10:58)

<meta name="twitter:card" content="summary" />  
<meta property="og:url" content="{% CurrentDocument.AbsoluteURL #%}" />
<meta property="og:title" content="{% CurrentDocument.DocumentName #%}" />
<meta property="og:description" content="{% Summary %}" />
<meta property="og:image" content="" />
My meta property
0 votesVote for this answer Mark as a Correct answer

Alex Koshel answered on March 19, 2021 11:08

Thank.

0 votesVote for this answer Mark as a Correct answer

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