1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Meta Description

Discussion in 'XenForo Questions and Support' started by akia, Apr 12, 2013.

  1. akia

    akia Well-Known Member

    I'm trying to set up the twitter card meta tags but I'm having problems with this one:

    <meta name="twitter:description" content="">

    I've tried:

    <xen:if is="{$pageDescription.content} AND !{$pageDescription.skipmeta} AND !{$head.description}"><meta name="twitter:description" content="{xen:string wordTrim, {xen:helper stripHtml, {xen:raw $pageDescription.content}}, 200}"></xen:if>


    <meta name="twitter:description" content="{xen:raw $pageDescription.content}">

    but neither will output the description when I check the page source. Can anyone help with what I should use?
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    What is the context? Which template are you editing? What page?
  3. akia

    akia Well-Known Member

    I'm editing the PAGECONTENT template. and placing it in the head.
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    There is no PAGECONTENT template. Do you mean PAGE_CONTAINER? Just add it to the head:

    <!DOCTYPE html>
    <html id="XenForo" lang="{$visitorLanguage.language_code}" dir="{$visitorLanguage.text_direction}" class="Public {xen:if {$visitor.user_id}, 'LoggedIn', 'LoggedOut'} {xen:if {$sidebar}, 'Sidebar', 'NoSidebar'}" xmlns:fb="http://www.facebook.com/2008/fbml">
    <xen:hook name="page_container_head">
    	<meta charset="utf-8" />
    	<xen:if is="{$requestPaths.fullBasePath}">
    		<base href="{$requestPaths.fullBasePath}" />
    		<script><xen:comment>/* Chrome bug and for Google cache */</xen:comment>
    			var _b = document.getElementsByTagName('base')[0], _bH = "{xen:jsescape $requestPaths.fullBasePath}";
    			if (_b && _b.href != _bH) _b.href = _bH;
    	<title><xen:if is="{$title}">{xen:raw $title} | {$xenOptions.boardTitle}<xen:else />{$xenOptions.boardTitle}</xen:if></title>
    	<noscript><style>.JsOnly { display: none !important; }</style></noscript>
    	<link rel="stylesheet" href="css.php?css=xenforo,form,public&amp;style={xen:urlencode $_styleId}&amp;dir={$visitorLanguage.text_direction}&amp;d={$visitorStyle.last_modified_date}" />
    	{xen:helper ignoredCss, {$visitor.ignoredUsers}}
    	<xen:include template="google_analytics" />
    	<xen:include template="page_container_js_head" />
    	<link rel="alternate" type="application/rss+xml" title="{xen:phrase rss_feed_for_x, 'title={$xenOptions.boardTitle}'}" href="{xen:link forums/-/index.rss}" />
    	<xen:if is="{$pageDescription.content} AND !{$pageDescription.skipmeta} AND !{$head.description}"><meta name="description" content="{xen:string wordTrim, {xen:helper stripHtml, {xen:raw $pageDescription.content}}, 200}" /></xen:if>
    	<xen:if is="{$head}"><xen:foreach loop="$head" value="$headElement">{xen:raw $headElement}</xen:foreach></xen:if>
    	<meta name="twitter:description" content="">
  5. kingston

    kingston Well-Known Member

    Where you able to get this to work? I want to add this to my forum. I have my forum auto post links when threads become Hot Threads (aka have enough views to warrant them being worthy of reposting). I really want the tweet to be a deeper tweet than just a link.
  6. kingston

    kingston Well-Known Member

    Do you know how to do this?
  7. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Do what exactly?
  8. Tracy Perry

    Tracy Perry Well-Known Member

  9. akia

    akia Well-Known Member

    No, I never was able to.
  10. kingston

    kingston Well-Known Member

    You can set it up on your site that when you tweet a link it will create a twitter card. If you post a link to iTunes you can see a good example. From what I can tell this can be done by anyone. As there is options to share pages from Xenforo to Twitter I think it is a lot more engaging if there was a Twitter card for someones forum with the information shared.

  11. akia

    akia Well-Known Member

    Just like with the Facebook Meta Tags, Twitter now have them.

    <meta name="twitter:card" content="summary">
    <meta name="twitter:site" content="@nytimes">
    <meta name="twitter:creator" content="@SarahMaslinNir">
    <meta name="twitter:title" content="Parade of Fans for Houston’s Funeral">
    <meta name="twitter:description" content="NEWARK - The guest list and parade of limousines with celebrities emerging from them seemed more suited to a red carpet event in Hollywood or New York than than a gritty stretch of Sussex Avenue near the former site of the James M. Baxter Terrace public housing project here.">
    <meta name="twitter:image" content="http://graphics8.nytimes.com/images/2012/02/19/us/19whitney-span/19whitney-span-article.jpg">
    and its these I'm trying to get working.
  12. akia

    akia Well-Known Member

    I need to add the page meta description in the content bit.
  13. akia

    akia Well-Known Member

    Can no one help with this?

    What variable would I need to use to be able to use the meta description tag text elsewhere in a different template.

Share This Page