![]() |
Facebook / Open Graph (og:description) / (og:title) tag fixes for VB 4.1.10+ by BOP5
1 Attachment(s)
Brought to you by BirdOPrey5 / Qapla.com.
For some reason vBulletin 4.x does not use the thread's meta description when populating the open graph "description" tag that is read by Facebook and other social networking sites. Instead by default vBulletin uses your site default meta description that is set in Admin CP -> Settings -> Options -> Site Name / URL / Contact Details. This default description is usually very generic whereas the thread description is the first few sentences of the thread and therefore usually far more useful to describe the page actually being shared than your generic site description. Also even with the Facebook Platform enabled vBulletin doesn't provide an open graph title tag at all- while in practice this isn't a big deal as Facebook will default to the page title, as a matter of good practice it should be explicitly provided. This mod fixes both issues. It will override the generic description with the thread's meta description which is based on the text of the first post. It also adds an explicit og:title tag. New In Version 1.2.0 - The mod now also greatly improves the open graph tag description tag for blog entries. By default the description tag is the blog title followed by the username of the blog poster. With this mod the description becomes up to a 300 character preview of the actual blog entry instead. And the open graph title tag provided takes the form of blog title Posted By username. Blog Demo: http://www.totallycommercials.com/en...ckbuster-Video Thread Demo: http://www.totallycommercials.com/sh...how-Commercial (View page source or better yet, share on Facebook to see the differences. ;)) This mod is only for people with VB 4.1.10 or higher and only if you have the Facebook Platform enabled in your settings. It will do nothing if both of those do not apply to you. There are no settings- just install the product and the mod is active. To see the difference use the Facebook Debugger to look at the content scraped off a thread page before and after instillation- Facebook Debugger is here: https://developers.facebook.com/tools/debug ------------------------------------------------------ Please "Mark as Installed" if you use this. :) Donations always appreciated. :up: Nominate MOTM if you LOVE it! ;) |
Reserved.
|
Using 4.2.0 PL3 - For me the og:description did not change. Although it looked good already (first 150 chars. of the thread). The og:title property was added but the content is blank.
|
Quote:
|
I am using 4.2.0 PL3 and it worked great!
Thank you for this BOP. |
Quote:
|
Quote:
|
Quote:
|
Installed, and it works as advertised.
If only my FB-Connect button was working too!!!!!!!! |
Installed and voted for MOTM!
|
OK, I solved my Connect button issue and I made a small change to this hack, so that it covers all pages of the site. Here is the code I used.
Code:
if (THIS_SCRIPT == 'showthread') |
Quote:
|
Obviously Joe is right about this (not using my code shown above, if you are using vBSuite.
However, being the stubborn person I am, I keep trying to figure out how to fill the og: array with the proper values. So far, here is what I have come up with: Code:
if (THIS_SCRIPT == 'showthread') I am using the blog_show_entry template as a guide line, and in there, it appears that the proper variable to use is indeed $blog['message'], but that is obviously not set, when the script above loads?? I do not understand. Interestingly enough, the vbcms articles automatically get the proper og:description (the article text itself, but their title comprises of the site title and then the title of the article. I wonder if there is a way to use only the article's title. |
Looks cool, thanks
|
sv1cec, and everyone-
I went ahead and upgraded this to version 1.2.0- it now adds full support for a blog description (limited to 300 characters if need be) and a better blog title. The blog title is now formatted "blog title Posted By username" And the "Posted By" uses the default vBulletin phrase so it will translate to whatever language your forum uses. I did a lot of research on using it for Articles- it does not appear worth the effort- the way Articles are coded you simply can't get the title or preview text where the facebook open graph text is built. It could be done but would likely need additional plugins- but besides that Articles have a meta description option that you can fill in yourself and if available vBulletin does use the meta description as the open graph description on Article pages. |
I've got a 4.2.2 forum, and have just installed this, but it doesn't seem to be working, I've gone from the Thread title to the URL and from the generic meta description to nothing !
https://www.facebook.com/groups/footballounge/ |
Quote:
https://developers.facebook.com/tool...Carroll-regret The image must be a full absolute URL, with the http at the front, not the relative path you have. |
Quote:
|
I am using vb 4.1.7 is there anyway you could get this to work for 4.0 and higher?
|
Quote:
If You want I suppose you can add the hook manually. You'll need to edit 2 things. First, edit your includes/functions_facebook.php file Find the line: Code:
return $og_array; Code:
($hook = vBulletinHook::fetch_hook('fb_opengraph_array')) ? eval($hook) : false; Then edit this product's .xml file before you import it to product manager. Find: Code:
4.1.10 Code:
4.0.0 It *should* work. Also note- you'll never be able to edit the plugin in plugin manager because your vBulletin version doesn't know the hook exists and won't let you re-save the plugin in the correct hook. Not that you should have any reason to edit the plugin, just keep it in mind. |
How can we get this to work with CMS articles. Why would someone overlook something like this?
|
edit* I tried to do it came to a fail, and then saw your post on why it's harder to get the article title value in the head.
Has anyone written a script that gets the value of thread title for the requested cms article and inserts that into the og array? I'm sure it's a dirty solution, but I have no idea why vbulletin thought this wouldn't be a useful patch. |
The og title tag isn't that important, if not present the page title is used instead- I only threw it in since it was only 1 line of code for the blogs/threads... It isn't worth the effort to add it for CMS articles in my opinion.
|
Any plans on extending this very useful modification to Social Groups?
Thank you |
Hello..
I saw this two is blank when i open a thread and view source: <meta property="og:description" content="" /> <meta property="og:title" content="" /> Is it normal? i'm using 4.2.1 |
Quote:
Quote:
|
Hello..
No.. i didnt install the VSa - Forums Online CountUp mods, i'm using this mods: GlowHost - Spam-O-Matic Spam Hammer 1-Series [OzzModz] First Post On All Pages Per Thread/Forum SevenSkins Image Resizer Rotating Banner System Separate Sticky and Normal Threads |
Have you switched on the Facebook options, in the Options/Facebook Admin page?
|
Quote:
|
Quote:
Gripi, are you using the Atakan one, or mine? Separate Sticky and Normal Threads |
Quote:
Quote:
Quote:
I already disable the "[OzzModz] First Post On All Pages Per Thread/Forum", but still blank. And i use the Atakan for the Separate Sticky and Normal Threads |
Ok glad top hear it is not a conflict with one of my mods, hopefully Bop5 will figure it out for you.
|
Thanks for your great work!
Is there a way to integrate the metatags without having to activate facebook in the AdminCP and enter an FB App ID? |
Not with this mod.
|
Great.. fixed the problem for me..donated some $ :D
|
do we still need this mod ?? because there a lot of facebook fixes all around here!
|
Quote:
|
No. Sorry.
|
Hi there I have a question. Is there a way to integrate this with the mobile style? I see the facebook "like" button vb natively installs but for whatever reason this mod doesn't seem to add the sharing options to the mobile style. Thats an issue for me because 64% of my traffic is mobile.
|
Quote:
Example random link to a random thread and mobile style: http://www.qapla.com/mods/showthread...but?styleid=13 If you look at the source of the page all the og tags are there with the relevant title and descriptions. Maybe you are thinking of my More Sharing Options TNG mod? |
All times are GMT. The time now is 10:31 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|