Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
DReffects2 Posted January 16, 2019 Posted January 16, 2019 Hey Guys, so I am having a bit of a problem at the moment as I'd like to specify an image that i am using inline a certain database record as the og:image meta thingy for facebook. IPS supports to have the record image to be the og:image meta tag in the header by default, but this is not what I need right now. Unfortunately Facebook only crawls within the header for og:image meta tags so an inline meta tag is getting ignored. Do you guys have a good idea on how to approach this issue? Thanks -Daniel
opentype Posted January 16, 2019 Posted January 16, 2019 You can push it to the header from the template. {{\IPS\Output::i()->metaTags['og:image'] = $your_URL;}}
DReffects2 Posted January 16, 2019 Author Posted January 16, 2019 1 hour ago, opentype said: You can push it to the header from the template. {{\IPS\Output::i()->metaTags['og:image'] = $your_URL;}} thank you! Is there a documentation on all the functions like this? I guess this will only work within templates though... if i upload an inline image like this one: and want to make THIS image the og:image, how would I do that?
opentype Posted January 16, 2019 Posted January 16, 2019 Yeah, you do it in the template. You can create a new database field and only if something is uploaded for that field, you push the content out as OG:image. That’s a clean solution. I use that all the time.
DReffects2 Posted January 16, 2019 Author Posted January 16, 2019 4 hours ago, opentype said: Yeah, you do it in the template. You can create a new database field and only if something is uploaded for that field, you push the content out as OG:image. That’s a clean solution. I use that all the time. Ah sweet, never thought about doing it this way. Only downside is server storage space I guess 🙂 Thanks for helping out!
opentype Posted January 16, 2019 Posted January 16, 2019 Just for the sake of completeness: all of that is of course only done if there are good reasons why you don’t want to use the Record Image. That field is specifically made to upload an image to represent the record and setting it as og:image is a default feature in 4.x.
DReffects2 Posted January 16, 2019 Author Posted January 16, 2019 11 minutes ago, opentype said: Just for the sake of completeness: all of that is of course only done if there are good reasons why you don’t want to use the Record Image. That field is specifically made to upload an image to represent the record and setting it as og:image is a default feature in 4.x. The record image serves a different purpose in the current scenario, I will most certainly keep this in mind!
Recommended Posts
Archived
This topic is now archived and is closed to further replies.