1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Other [Solved]Twitter cards for xenforo.

Discussion in 'Resource and Add-on Requests' started by zadow, Mar 22, 2015.

  1. zadow

    zadow Member

    Hello all

    I spend alot of time promoting my forum on twitter.
    I Like the platform, and how fast you can get tons of visitors.

    So i setup a feed with twitterfeed, to auto post to twitter.

    Its farly easy

    i explain the steps

    You add the rss link to sections from diserered forum rss that you would like to auto cast to twitter


    [​IMG]


    then next step select twitter, then setup how freg. it should be sync.

    Only problem is, that when i member post, it will auto cast that to twitter also.
    Good thing is that alot of visitors visit.



    But!
    So i dig into twitter apps some more.

    And the perfect thing would be a so called twitter card.
    https://dev.twitter.com/cards/overview

    It looks nicer and have support for media of various formats.

    here is a example using a website that have twittercards.
    I have a github account and when posting link to a reposotory on twitter, it shows a nice card of the tweet.

    [​IMG]

    Would be cool to have a option to have a card for our forum, with a card of new threads, made with a nice logo or video of the first post.

    What you say, anyone up for the challenge :)
     
  2. batpool52!

    batpool52! Well-Known Member

    zadow likes this.
  3. zadow

    zadow Member

    yes exactlly.
    :rolleyes:

    Is it automated, or did you somehow intregrated it into the twitter button.
    And how did you do it :)
     
  4. batpool52!

    batpool52! Well-Known Member

    zadow likes this.
  5. zadow

    zadow Member

    well it looks nice.
    But one thing i dont fully understand.
    Does the twittercard only apply to front page tweet button ?
    https://twitter.com/zadow28/status/579611885995225088
    i made a tweet front front page forum and it works , but if i tweet from a thread it dosent show ?
    Any idea
     
  6. batpool52!

    batpool52! Well-Known Member

    Was the thread link tweeted before you added the twitter meta tags?
     
  7. zadow

    zadow Member

    no i added meta then first tried post tweet forum, that worked.

    Then went into a thread, and tweeted from that and that shows normally.

    you see the meta within code frontpage page http://www.techbliss.org/
     
  8. batpool52!

    batpool52! Well-Known Member

    Code:
    <meta name="twitter:url" content="http://www.techbliss.org" />
    should be the page location, not home page location ;)
     
  9. zadow

    zadow Member

    Not sure i understand.
    I see you have a page other than homepage yourself, but how would i know what page to add.
    So if i make a new thread i have to add that link to the meta ?

    Maybe i misunderstood the twittercard uses

    I wanna show the card each time i use the twittercard from anywhere on the forum.
     
    Last edited: Mar 22, 2015
  10. batpool52!

    batpool52! Well-Known Member

    Try replacing the value inside twitter:url tag with this
    Code:
    {$requestPaths.fullUri}
     
    zadow likes this.
  11. zadow

    zadow Member

    never been good with PHP like this ? :whistle:
    Code:
    <meta name="twitter:url" content={$requestPaths.fullUri} />
     
  12. zadow

    zadow Member

    okay if i copy link from forum link and paste into tweed on twitter it works.
    If i use xenforo's own tweet button i doesnt show card

    UPDATE!!
    Appenrently it works also wit xenfor tweet button, It just took a minut before it appered correctly.
    All Works now.

    Thx for the help m8 (y)
     
    batpool52! likes this.
  13. RandyRS

    RandyRS New Member

    Hi, could you please help with this tags ?
    I want to change the value.

     
  14. Christina S

    Christina S New Member

    Can someone walk me thru how to setup up twitter card on my xenforo website correctly. Thank you.
     
  15. zadow

    zadow Member

    go into admin panel
    then Appearance >Templates
    search template open_graph_meta
    in template under

    HTML:
        <meta property="og:site_name" content="{$xenOptions.boardTitle}" />
        <xen:if is="{$avatar}"><meta property="og:image" content="{$avatar}" /></xen:if>
        <meta property="og:image" content="{xen:helper fullurl, @ogLogoPath, 1}" />
        <meta property="og:type" content="{xen:if $ogType, $ogType, article}" />
        <meta property="og:url" content="{xen:raw $url}" />
        <meta property="og:title" content="{xen:raw $title}" />
    insert twitter card

    Code:
        <meta property="og:site_name" content="{$xenOptions.boardTitle}" />
        <xen:if is="{$avatar}"><meta property="og:image" content="{$avatar}" /></xen:if>
        <meta property="og:image" content="{xen:helper fullurl, @ogLogoPath, 1}" />
        <meta property="og:type" content="{xen:if $ogType, $ogType, article}" />
        <meta property="og:url" content="{xen:raw $url}" />
        <meta property="og:title" content="{xen:raw $title}" />
        <meta name='twitter:card' content='summary_large_image'/>
        <meta name='twitter:image:src' content='http://i.imgur.com/YourImage.jpg'/>
        <meta name='twitter:site' content='@YourTwittername'/>
        <meta name='twitter:url' content={$requestPaths.fullUri}/>
        <xen:if is="{$description}"><meta property="og:description" content="{xen:raw $description}" /></xen:if>
        {xen:raw $ogExtraHtml}
        <xen:if is="{$xenOptions.facebookAppId}"><meta property="fb:app_id" content="{$xenOptions.facebookAppId}" /></xen:if>
        <xen:if is="{$xenOptions.facebookAdmins}"><meta property="fb:admins" content="{xen:helper implode, {$xenOptions.facebookAdmins}, ','}" /></xen:if>
    validate your card at twitter https://cards-dev.twitter.com/validator

    tweet any page and see if the picture turns up in twitter, can take a minut

    if trouble shoot you may have to make a token etc for you forum to get it to work.
    in admin forum options twitter and make a twitter app https://apps.twitter.com/

     
  16. Christina S

    Christina S New Member

    I am seeing the card in summary, however no picture. More help please.
     
  17. Christina S

    Christina S New Member

    Do I need to make any changes to the twitter code you posted above for my own xenforo website?
     
  18. zadow

    zadow Member

    its self explainable
    link to your own picture and profile

    <meta name='twitter:card' content='summary_large_image'/>
    <meta name='twitter:image:src' content='http://i.imgur.com/YourImage.jpg'/>
    <meta name='twitter:site' content='@YourTwittername'/>
    <meta name='twitter:url' content={$requestPaths.fullUri}/>
     
  19. Christina S

    Christina S New Member

    Alright, I am not sure I am understanding all this, so please bear with me. So if I post a tweet to twitter I get a blank card, no image. And its looking like a summary card.

    So here is what I tested, I posted a tweet from our forum to twitter, when I did it did not show the avatar of the poster of that thread, it was blank, even if I do a new post and then tweet it same thing. Blank? Can you give me a little more help please.
     
  20. zadow

    zadow Member

    did you upload a image you wanna use for your twitter card
    that what the
    <meta name='twitter:image:src' content='http://i.imgur.com/YourImage.jpg'/>

    is for

    also
    <meta name='twitter:url' content={$requestPaths.fullUri}/>
    is using the same image on all tweets, no matter where in your forum it is tweeted from.
     

Share This Page