Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 08-01-2015, 01:20 PM
ku-med's Avatar
ku-med ku-med is offline
 
Join Date: Aug 2013
Posts: 54
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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!
Reply With Quote
  #2  
Old 08-01-2015, 02:47 PM
z3r0's Avatar
z3r0 z3r0 is offline
 
Join Date: Apr 2005
Posts: 339
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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" />
Reply With Quote
2 благодарности(ей) от:
ku-med, MarkFL
  #3  
Old 08-01-2015, 02:52 PM
ku-med's Avatar
ku-med ku-med is offline
 
Join Date: Aug 2013
Posts: 54
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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} ?
Reply With Quote
Благодарность от:
MarkFL
  #4  
Old 08-04-2015, 06:21 PM
ku-med's Avatar
ku-med ku-med is offline
 
Join Date: Aug 2013
Posts: 54
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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}" />
Reply With Quote
Благодарность от:
MattGarner
  #5  
Old 11-23-2015, 03:10 AM
VICOS VICOS is offline
 
Join Date: Mar 2002
Posts: 13
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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}" />
in the SHOWTHREAD template right under <title></title>, then they would be inside of the <head></head> where technically they belong.

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>
Just look for the following line in headinclude as the place to sync up.

Code:
<vb:if condition="$show['threadinfo']">
and then add the Twitter stuff in where it belongs among the existing code as shown above. You have to go through all of this because the Thread Title and Meta Description are not available as variables in the headinclude template.

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.
Reply With Quote
Благодарность от:
z3r0
  #6  
Old 03-15-2016, 12:14 PM
PedroMA's Avatar
PedroMA PedroMA is offline
 
Join Date: Oct 2014
Location: Madrid (Spain)
Posts: 21
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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}">
but doesn't work.
Reply With Quote
  #7  
Old 03-15-2016, 02:00 PM
VICOS VICOS is offline
 
Join Date: Mar 2002
Posts: 13
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #8  
Old 03-15-2016, 03:02 PM
z3r0's Avatar
z3r0 z3r0 is offline
 
Join Date: Apr 2005
Posts: 339
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #9  
Old 03-15-2016, 08:23 PM
PedroMA's Avatar
PedroMA PedroMA is offline
 
Join Date: Oct 2014
Location: Madrid (Spain)
Posts: 21
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by z3r0 View Post
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
No, In my case without image meta doesn't charge anything. I need this for CMS, and I'm triying to insert the meta tags inside the headinclude or inside vbcms_content_article_page. The problems is that in headinclude or vbcms_content_article_page I can't catch attachments variable information.

Thanks for the reply. More ideas?

Regards.
Attached Images
File Type: jpg Captura de pantalla 2016-03-15 a las 22.19.21.jpg (61.0 KB, 0 views)
Reply With Quote
  #10  
Old 10-30-2016, 10:23 PM
PedroMA's Avatar
PedroMA PedroMA is offline
 
Join Date: Oct 2014
Location: Madrid (Spain)
Posts: 21
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I need to solve the issue. Something from vbulletin support staff can help me?
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:55 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.07708 seconds
  • Memory Usage 2,292KB
  • Queries Executed 12 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (6)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (5)post_thanks_box_bit
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (4)post_thanks_postbit
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (1)postbit_attachment
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_attachment
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete