Forum

Thread tagged as: Question, Problem, Twitter

Twitter template not showing on page details page

I have added the twitter.html page to my default.html template as per the example on using page attributes but it is not showing up on the page details page. It shows in the html code and the seo and Facebook details show up ok. I used the Twitter card validator and it returned this form the log.?

INFO:  Page fetched successfully
INFO:  18 metatags were found
INFO:  twitter:card = summary tag found
ERROR: Required meta tag missing (twitter:description)
ERROR: Required meta tag missing (twitter:title)
WARN:  Not whitelisted
David Roberts

David Roberts 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok - how can we help?

The twitter details to fill out is not showing in the details page like the Facebook ones do, or am I missing something?

Notifications are not working for me since yesterday.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you perhaps show us what you're doing?

<!doctype html>
<html>
<head>
(OTHER CODE)
<?php 
$domain        = 'https://'.$_SERVER["HTTP_HOST"];
$url           = $domain.$_SERVER["REQUEST_URI"];
$sitename      = "The name of my website";
$twittername   = "@mytwittername";
$sharing_image = '/images/default_fb_image.jpg';
PerchSystem::set_var('domain',$domain);
PerchSystem::set_var('url',$url);
PerchSystem::set_var('sharing_image',$sharing_image);
PerchSystem::set_var('twittername',$twittername);

perch_page_attributes(array(        
  'template' => 'default.html'    
));
?>
</head>
Drew McLellan

Drew McLellan 2638 points
Perch Support

If you add <perch:showall /> to your template, does it output the values you're passing in?

No, I don't get anything showing on the page details page.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Nothing at all?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ah, ok - I thought you were talking about output, not the form.

Can you show us your page attribute template?

This is the twitter. html template which is in the default.html template

<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="<perch:pages id="twittername" type="hidden" />" />
<meta name="twitter:title" content="<perch:pages id="og_title" label="Social title" type="text" escape="true" help="Title for this document with no branding or site name" />" />
<meta name="twitter:description" content="<perch:pages id="og_description" label="Social description" type="textarea" size="s" escape="true" />" />
<perch:if exists="og_image">
<meta property="twitter:image" content="<perch:pages id="domain" type="hidden" /><perch:pages id="og_image" label="Image when shared" help="Should be at least 1200x630" type="image" width="1200" />" />
</perch:if>
<meta name="twitter:url" content="<perch:pages id="url" type="hidden" />" />
Drew McLellan

Drew McLellan 2638 points
Perch Support

How is it included?

It is in the default template in the head section as above.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you show me?

Code below.

<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <link media="all" rel="stylesheet" href="/css/all2.css">
    <meta name="description" content="Digital Education looks at design, technology, and the theory of education and how this effects the education sector with an emphasis on Additional Support Needs">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="robots" content="index, folow">
    <link rel="apple-touch-icon" sizes="57x57" href="/favicon/apple-touch-icon-57x57.png">
    <link rel="apple-touch-icon" sizes="114x114" href="/favicon/apple-touch-icon-114x114.png">
    <link rel="apple-touch-icon" sizes="72x72" href="/favicon/apple-touch-icon-72x72.png">
    <link rel="apple-touch-icon" sizes="144x144" href="/favicon/apple-touch-icon-144x144.png">
    <link rel="apple-touch-icon" sizes="60x60" href="/favicon/apple-touch-icon-60x60.png">
    <link rel="apple-touch-icon" sizes="120x120" href="/favicon/apple-touch-icon-120x120.png">
    <link rel="apple-touch-icon" sizes="76x76" href="/favicon/apple-touch-icon-76x76.png">
    <link rel="apple-touch-icon" sizes="152x152" href="/favicon/apple-touch-icon-152x152.png">
    <link rel="apple-touch-icon" sizes="180x180" href="/favicon/apple-touch-icon-180x180.png">
    <link rel="icon" type="image/png" href="/favicon-192x192.png" sizes="192x192">
    <link rel="icon" type="image/png" href="/favicon-160x160.png" sizes="160x160">
    <link rel="icon" type="image/png" href="/favicon-96x96.png" sizes="96x96">
    <link rel="icon" type="image/png" href="/favicon-16x16.png" sizes="16x16">
    <link rel="icon" type="image/png" href="/favicon-32x32.png" sizes="32x32">
    <meta name="msapplication-TileColor" content="#2d89ef">
    <meta name="msapplication-TileImage" content="/favicon/mstile-144x144.png">
    <meta name="msapplication-config" content="/browserconfig.xml">
    <?php 
$domain        = 'https://'.$_SERVER["HTTP_HOST"];
$url           = $domain.$_SERVER["REQUEST_URI"];
$sitename      = "The name of my website";
$twittername   = "@mytwittername";
$sharing_image = '/images/default_fb_image.jpg';
PerchSystem::set_var('domain',$domain);
PerchSystem::set_var('url',$url);
PerchSystem::set_var('sharing_image',$sharing_image);
PerchSystem::set_var('twittername',$twittername);
Perch:showall;
perch_page_attributes(array(        
  'template' => 'default.html'    
));
?>
    <script type="text/javascript" src="https://fast.fonts.net/jsapi/acf16de1-4e86-4df5-9741-f13925d27ce5.js"></script>
<script type="text/javascript">
        var html = document.getElementsByTagName('html')[0];
        html.className += '  wf-loading';
        setTimeout(function () {
            html.className = html.className.replace(' wf-loading', '');
        }, 5000);
        WebFontConfig = { fontdeck: { id: '6709' } };

(function() {
  var wf = document.createElement('script');
  wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
  '://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
  wf.type = 'text/javascript';
  wf.async = 'true';
  var s = document.getElementsByTagName('script')[0];
  s.parentNode.insertBefore(wf, s);
})();
</script>
</head>
Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you show me the default.html page attribute template?

here it is

<perch:template path="pages/attributes/seo.html" />
<perch:template path="pages/attributes/facebook.html" />
<perch:template path="pages/attributes/twitter.html" />
Drew McLellan

Drew McLellan 2638 points
Perch Support

I think in your template where you have type="hidden" you almost certainly don't want that. Try type="text" instead.

Changed the twitter template (I guess that's the one you meant) hidden x3 to text but no change. FYI The Facebook template has the same sort of set up and has type="hidden" x5

Drew McLellan

Drew McLellan 2638 points
Perch Support

Why are they hidden?

The wrong person to ask Drew:) I just thought it would work like most things!

I just used what is on this page.

https://solutions.grabaperch.com/integrations/facebook-and-twitter-sharing