Forum

Thread tagged as: Question, Problem

SEO.html - Title Tag

I have tried adding a title to my seo.html as shown below but the page title does not seem to change when saved

<meta name="title" content="<perch:pages id="title" label="Title" type="text" size="xs" escape="true" />" />

Rob Broley

Rob Broley 0 points

  • 7 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you show us the HTML output you get?

Its just a blank space with it referencing the domain as the tag is not present.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Are you taking about the HTML <title> element?

Drew McLellan said:

Are you taking about the HTML <title> element?

Yes thats the one Ive tried adding it to the default seo.html template but nothing seems to happen when I input a title in through perch. But I have taken it out as I noticed by default that there is a page title included but that does not seem to work either.

Do you have <title><?php perch_pages_title(); ?></title> in the HTML of your page so that it picks up the 'Page Title' contents from 'Page Details'?

Graham Street said:

Do you have <title><?php perch_pages_title(); ?></title> in the HTML of your page so that it picks up the 'Page Title' contents from 'Page Details'?

No Graham I have not tried that piece of code. I will add that now. Can I add that to the default seo.html template?

Drew McLellan

Drew McLellan 2638 points
Perch Support

You could. Perch already has fields for title, so you shouldn't need to. Best just to add it to your layout.

Rob Broley said:

No Graham I have not tried that piece of code. I will add that now. Can I add that to the default seo.html template?

If it helps, this is what I have at the top of all pages to pick up the page title, description, keywords, meta robots (and any other page attributes you care to add to seo.html) for the page ...

<title><?php perch_pages_title(); ?></title>
<?php     
perch_page_attributes(array(        
  'template' => 'seo.html'    
)); 
?>