News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

how do i enable Twitter card tag on smf

Started by abula, October 12, 2016, 07:28:37 AM

Previous topic - Next topic

abula

Hi everyone.
I tried to implement twitter tag on my forum using 2.0.12 because links in twitter looks ugly.
I tried to use prematch function to fetch the first image in post but its not working, i will be very glad if someone can help with the codes to use or a mod... Thanks


abula

Thank you so much for this, i will give it a try and give a feedback soon

abula

This mod embeds tweets on forum, not exactly wat i want.
If i share a link on facebook, it feches the link first image and uses it as thumbnail, but twitter does not, will like to have a mod that will fetch first image as thumbnail anytime link is shared on twitter

Antes


abula

Quote from: Antes on October 12, 2016, 12:19:50 PM
Then you should look up for og:image  (http://ogp.me/). [nofollow]
og:image is for facebook, i have no problem with facebook.
My problem is twitter, hav tried using twitter:image using prematch to fetch first image but noting seems to work.
Is there really no solution  :-\ :'(

Antes

That's interesting, OG:Image should be working well with Twitter (G+) as well. If its not working with code below, then something fishy from twitter side (or you are blocking the images with Ghostery/ADB(or equal))

<meta name="twitter:image" content="...">

abula

Thanks, but what sould i put in content to display first image in post?

Antes

Quote from: abula on October 12, 2016, 02:59:42 PM
Thanks, but what sould i put in content to display first image in post?

You can search in this forum, you'll find how to fetch first image in the post. I don't have the code at the moment unfortunately.

abula

I downloaded the open graph mod and added twitter tags in open_g_hook.php in sources.
But when i tried to validate the card using twiter card validator, i got error blocked by robot.txt  :-[,
Pls what should i do next

abula

This is the content of my robot.txt

User-agent: *
Disallow: /profile/
Disallow: /help/
Disallow: /search/
Disallow: /search2/
Disallow: /activate/
Disallow: /stats/
Disallow: /admin/
Disallow: /trackip/
Disallow: /pm/
Disallow: /logout/
Disallow: /reminder/
Disallow: /mlist/
Disallow: /moderate/
Disallow: /unread/
Disallow: /help/
Disallow: /credits
Disallow: /unread*
Disallow: /*sort=
Disallow: /sources/
Disallow: /backup/
Disallow: /*wap*

User-agent: Twitterbot
Disallow:

User-agent: Googlebot-Image
Disallow: /

User-agent: YandexImages
Disallow: /

User-agent: msnbot-media
Disallow: /

User-agent: MSNBOT_Mobile
Allow: /*wap
Disallow: /

User-agent: Googlebot-Mobile
Allow: /*wap
Disallow: /

User-agent: MediaPartners-Google
Allow: /

s3cc0

Quote from: abula on October 12, 2016, 01:44:03 PM
My problem is twitter, hav tried using twitter:image using prematch to fetch first image but noting seems to work.
Is there really no solution  :-\ :'(

Have you tried testing your page with Twitter Card Validator? https://cards-dev.twitter.com/validator
Hacker, Pirate, Milf Hunter, Owner of Bitcoin Garden Forum

Advertisement: