Posted October 24, 20159 yr Does anyone have any experience to adding meta tags for Twitter Cards when it comes to the Pages application? I was looking at the includeMeta template within core->global->global to potential add some form of if statement that if on the pages application, grab the author and various other data that is tied to the current page (ie an article). Any help would be appreciate as I couldn't find much when searching.
October 24, 20159 yr You mean to make your board bages displyaed properly in Twitter when shared by someone? https://dev.twitter.com/cards/overview Or you mean embedding tweets in your board content items (posts, comments etc.)?
October 24, 20159 yr Author Just now, Ibragim Pupkevich said: You mean to make your board bages displyaed properly in Twitter when shared by someone? https://dev.twitter.com/cards/overview Or you mean embedding tweets in your board content items (posts, comments etc.)? In regards to board pages being displayed in Twitter when shared. More specifically I'm looking at it in regards to articles on my site, but other pages are applicable I guess.
October 24, 20159 yr Author For the time being I've hacked together this in the includeMeta template which at least gives me the title and description but obviously I could do with it being a little cleaner and include author data and possibly image. <meta name="twitter:card" content="summary" /> <meta name="twitter:site" content="@RespawnGG" /> {{foreach \IPS\Output::i()->metaTags as $name => $content}} {{if $name != 'title'}} {{if is_array( $content ) }} {{foreach $content as $_value }} {{if $name === 'og:title'}} <meta name="twitter:title" content="{$_value}"> {{endif}} {{if $name === 'og:description'}} <meta name="twitter:description" content="{$_value}"> {{endif}} {{endforeach}} {{else}} {{if $name === 'og:title'}} <meta name="twitter:title" content="{$content}"> {{endif}} {{if $name === 'og:description'}} <meta name="twitter:description" content="{$content}"> {{endif}} {{endif}} {{endif}} {{endforeach}}
January 10, 20169 yr <meta name="twitter:card" content="summary_large_image"> <meta name="twitter:site" content="@cheersngears"> <meta name="twitter:image" content="{$this->settings['meta_imagesrc']}" /> <if test="metatags:|:is_array( $metaTags ) AND count( $metaTags )"> <foreach loop="metaTags:$metaTags as $tag => $id"> <foreach loop="metaTagsInner:$metaTags[ $tag ] as $content"> <if test="ogCaveman:|:stristr( $tag, 'og:' )"> <meta property="{$tag}" content="{$content}" /> <else /> <meta name="{$tag}" content="{$content}" /> </if> <if test="hasIdentifier:|:$tag == 'identifier-url'"> <meta property="og:url" content="{$content}" /> </if> <if test="hasDescription:|:$tag == 'description'"> <meta property="og:description" content="{$content}" > <meta name="twitter:description" content="{$content}" /> </if> <if test="hasDescription:|:$tag == 'title'"> <meta property="og:title" content="{$content}" > <meta name="twitter:title" content="{$content}" /> </if> </foreach> </foreach> </if> <meta property="og:image" content="{$this->settings['meta_imagesrc']}" />
Archived
This topic is now archived and is closed to further replies.