The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Twitter Card Feature!
Hello!
I want to ask how to setup this cool feature of twitter to my vbulletin forum https://dev.twitter.com/cards/types/summary I don't know where to post that code? Any ideas how to make that work in vbulletin? Thanks in advance! |
#2
|
||||
|
||||
I added it to the top bit of the headinclude template bellow all the other meta stuff.
Code:
<meta name="twitter:card" content="summary" /> <meta name="twitter:site" content="@yourtwitteraccountname" /> <meta name="twitter:description" content="{vb:raw vboptions.description}" /> <meta name="twitter:title" content="your site title" /> |
#3
|
||||
|
||||
Thanks mate : ) : ) : )
Edit: Hmm will the twitter card content display the text of each topic when i post the url in twitter ? or it will just display my site description by using this code {vb:raw vboptions.description} ? |
Благодарность от: | ||
MarkFL |
#4
|
||||
|
||||
Whenever someone post a link of any thread in the forums, I'd like to see in the twitter card: Title of thread plus the first lines text of that thread. So I've tried to put this code in the SHOWTHREAD but it didn't work tho .. Any ideas how to make that work? Like in this pic ignoring the image thumbnail.
<meta name="twitter:card" content="summary" /> <meta name="twitter:site" content="@mytwitteraccount" /> <meta name="twitter:description" content="{vb:raw thread.meta_description}" /> <meta name="twitter:title" content="{vb:raw thread.prefix_plain_html} {vb:raw thread.title}" /> --------- Edit ------------ Finally it's worked I had to add these two codes in the showthread template at the end before </html> Code:
<meta name="twitter:description" content="{vb:raw thread.meta_description}" /> <meta name="twitter:title" content="{vb:raw thread.prefix_plain_html} {vb:raw thread.title}" /> |
Благодарность от: | ||
MattGarner |
#5
|
|||
|
|||
You could actually put
Code:
<meta name="twitter:description" content="{vb:raw thread.meta_description}" /> <meta name="twitter:title" content="{vb:raw thread.prefix_plain_html} {vb:raw thread.title}" /> Then, I changed headinclude to look like this: Code:
<meta name="twitter:card" content="summary" /> <meta name="twitter:creator" content="@twitteruser" /> <meta name="twitter:site" content="@twitteruser" /> <meta name="twitter:image" content="http://images.com/twitter-02.png" /> <vb:if condition="$show['threadinfo']"> <!-- Twitter title, description set in template SHOWTHREAD --> <vb:elseif condition="$show['foruminfo']" /> <meta name="twitter:title" content="{vb:raw foruminfo.title_clean} - {vb:raw vboptions.bbtitle}" /> <meta name="twitter:description" content="{vb:raw foruminfo.description_clean}" /> <meta name="keywords" content="{vb:raw foruminfo.title_clean}, {vb:raw vboptions.keywords}" /> <meta name="description" content="<vb:if condition="$pagenumber > 1">{vb:rawphrase page_x, {vb:raw pagenumber}}-</vb:if>{vb:raw foruminfo.description_clean}" /> <vb:else /> <meta name="twitter:title" content="{vb:raw vboptions.bbtitle}" /> <meta name="twitter:description" content="{vb:raw vboptions.description}" /> <meta name="keywords" content="{vb:raw vboptions.keywords}" /> <meta name="description" content="{vb:raw vboptions.description}" /> </vb:if> Code:
<vb:if condition="$show['threadinfo']"> This way, you will get a Twitter card that makes sense for each of the following type of pages: 1) A forum page, 2) a Thread , 3) any other page. Hope this helps. |
Благодарность от: | ||
z3r0 |
#6
|
||||
|
||||
I'm searching about that the "twitter:image" charge automatically the first image attach. Any idea?
--------------- Added 15 Mar 2016 at 14:22 --------------- I'm trying with Code:
<meta name="twitter:image" content="http://url.com/attachment.php?attachmentid={vb:raw attachmentid}&d={vb:raw attachmentinfo.dateline}"> |
#7
|
|||
|
|||
That's the way most people would probably like it to work, but, if I remember correctly, this is not easily accomplished within the framework of vB v4. You would probably have to write/mod PHP code to make this happen. I imagine that there is a table with a 1-MANY relationship which maps the postID to attachments. References to attachments are probably only available in the section of code which loops thru all of the posts in a thread and displays them.
So, you would have to find the first post in a thread and then query the attached images, select the first one and make this data available in the section of code which processes the <head></head> section of the output. |
#8
|
||||
|
||||
According to the twittercard dev page if the tag isn't present then it will fall back and look for opengraph properties, so you should be able to leave out the twitter:image tag and let the following mod put the opengraph ones in.
https://vborg.vbsupport.ru/showthread.php?p=2434215 |
#9
|
||||
|
||||
Quote:
Thanks for the reply. More ideas? Regards. |
#10
|
||||
|
||||
I need to solve the issue. Something from vbulletin support staff can help me?
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|