Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted December 28, 20195 yr 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?
December 28, 20195 yr 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.
December 30, 20195 yr Author {{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 🙂
December 30, 20195 yr Author 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?
December 30, 20195 yr Author Yes, in old articles its NULL, so it hides old article images. What is sql quoery to fix this? 🙂 ipb_cms_custom_database_8
December 30, 20195 yr Author 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! 😍
December 30, 20195 yr Author 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:
Archived
This topic is now archived and is closed to further replies.