Facebook og:title

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • alexm
    Member
    • Feb 2004
    • 73
    • 4.2.x

    [Forum] Facebook og:title

    Hi,

    I'm trying to insert og:title into headerinclude like this:

    <meta property="og:title" content="{vb:raw thread.title}">

    but {vb:raw thread.title} appears to be empty in this template.

    any ideas how I can get around this?

    thanks,

    Alex
  • alexm
    Member
    • Feb 2004
    • 73
    • 4.2.x

    #2
    The issue I was trying to fix was that when posting a link to my forum on Facebook it wouldn't use the thread title, it would just use the title from the home page.

    After troubleshooting the page using Facebook's debugger it seemed to be picking up an incorrect canonical URL (so ended up with my default 404 page) and was using the default HTML Title from that page.

    Basically the problem is in SHOWTHREAD where it has
    PHP Code:
    <link rel="canonical" href="{vb:raw thread_url}" /> 
    This is returning a relative URL "showthread.php/xxxxxxx" and for some reason Facebook is interpreting this as http://my.forum/showthread.php/showthread.php/xxxxxxxx which of course doesn't exist.

    I changed the above code in SHOWTHREAD to
    PHP Code:
    <link rel="canonical" href="{vb:raw vboptions.bburl}/{vb:raw thread_url}" /> 
    so it returns the full absolute URL.

    Now Facebook scrapes the correct page and extracts the Title correctly without requiring an og: tag.

    Comment

    • Mark.B
      vBulletin Support
      • Feb 2004
      • 24286
      • 6.0.X

      #3
      Glad you sorted it and thanks for posting back the solution...I must confess I did something similar with my own site some time ago.
      MARK.B
      vBulletin Support
      ------------
      My Unofficial vBulletin 6.0.0 Demo: https://www.talknewsuk.com
      My Unofficial vBulletin Cloud Demo: https://www.adminammo.com

      Comment

      widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
      Working...