Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
Owdy Posted December 28, 2019 Posted December 28, 2019 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?
opentype Posted December 28, 2019 Posted December 28, 2019 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.
Owdy Posted December 30, 2019 Author Posted December 30, 2019 {{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 🙂
Owdy Posted December 30, 2019 Author Posted December 30, 2019 Seems in old articles, ill have to edit and toggle NO/YES and save, then it works. Yes is default, but now all images are hidden from old articles How do i set YES to all old articles? Some sql quoery?
Owdy Posted December 30, 2019 Author Posted December 30, 2019 Yes, in old articles its NULL, so it hides old article images. What is sql quoery to fix this? 🙂 ipb_cms_custom_database_8
Owdy Posted December 30, 2019 Author Posted December 30, 2019 ALTER TABLE `ipb_cms_custom_database_8` CHANGE `field_22` `field_22` INT(10) NULL DEFAULT '1'; This? edit: no... This? UPDATE ipb_cms_custom_database_8 SET field_22 = '1'; @opentype heeelp 🙂 edit3. it WORKED! Thank you! 😍
Owdy Posted December 30, 2019 Author Posted December 30, 2019 I use this forexample articles where are only video, like this:https://hoitajat.net/ajankohtaista/ensihoitajan-koskettava-joululaulu-varpunen-jouluaamuna-r919/ Now i can set nice share image for it, like this:
Recommended Posts
Archived
This topic is now archived and is closed to further replies.