Customizing SMF > SMF Coding Discussion

Anyone got twitter Card Validator working?

(1/1)

DreadPirateRoberts:
Im wonder what to put inot the code so an image will show up when I put in twitter card validator to work. So far I know that this code works when I put into the header tags in index. template



--- Code: ---<meta name="twitter:card" content="summary_large_image">
--- End code ---
but I dont know what to put here so that twitter will take the BBc image on the first post to work? and also the title



--- Code: ---<meta name="twitter:title" content="">
<meta name="twitter:image" content="">
--- End code ---


Can someone help me?


drewactual:
goes like this:


--- Quote --- <meta property="og:url" content="your web address here" />
    <meta property="og:type" content="website" />
    <meta property="og:title" content="title of your page here" />
    <meta property="og:description" content="a little longer description here" />
    <meta property="og:image" content="address to image here, preferably in .png and proper size" />
    <meta name="twitter:card" content="summary" /> <!-- literally JUST the word summary, tells twitter what it is -->
    <meta name="twitter:site" content="@your twitter account name" />
    <meta name="twitter:title" content="site's title just like above in og:title" />
    <meta name="twitter:description" content="again like the OG description" />
    <meta name="twitter:image" content="address to the image you want twitter to use, can be same as og:image if you wish" />

--- End quote ---

you COULD use a php script to pull the first image and offer it up to twitter- but- twitter is known to cache these things and that may cause you issues... i find it better to use a static image.  if you want you can have a conditional script to offer different cards for different boards, which is something i do- but those are static too.

if you're relying on social media to drive traffic i highly rec you get the open graph and the cards right... along with prettyURL's, this impacts users who are more likely to engage when they can see a 'taste' of what they'll find on your page.  i know that is debatable to many here, but it's worked for me on several sites. 

Navigation

[0] Message Index

Go to full version