Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted January 16, 20196 yr 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
January 16, 20196 yr You can push it to the header from the template. {{\IPS\Output::i()->metaTags['og:image'] = $your_URL;}}
January 16, 20196 yr Author 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?
January 16, 20196 yr 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.
January 16, 20196 yr Author 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!
January 16, 20196 yr 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.
January 16, 20196 yr Author 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!
Archived
This topic is now archived and is closed to further replies.