Jump to content

Share image in database article


Owdy

Recommended Posts

If i upload Record Image, its used also in social media share image:

<meta property="og:image" content="https://******net/uploads/monthly_2019_12/12.jpg.cd2592c7bc930062a.jpg">

Is there way to make field Record Image hidden, so it would not show in page, but be used as share image? Also, i sometimes wanna show it, sometimes not. Show when i create article, it would be setting  as hidden/visible. Possible?

Link to comment
Share on other sites

Well, it would need template customization. You can add a custom YesNo field to the article database and then wrap the image output with a condition checking that field. 
I have a database where I do the same for the showing or hiding the record author. 

{{if $record->field_123}}
//Output something
{{endif}}

“123” is the field ID of the checkbox field. 

P.S. Using the record image as sharer image is defined in the code and so it works independently from actually showing the image on the page. 

Link to comment
Share on other sites

 

{{if $record->record_image}}
		<div class="cCmsRecord_image">
              	
                {{if $record->field_kuva44}}
	       <img class="ipsImage" src="{file="$record->_record_image_thumb" extension="cms_Records"}">
                {{endif}}
          
          <div style="margin-top:5px">{$record->customFieldDisplayByKey('kuvateksti')|raw}</div>
		</div>
{{endif}}

Tryed this. It hides image even if selected YES. kuva44 is key

edit: typo, IT WORKS!!! Thanks 🙂

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...