Forum
Meta Titles & Descriptions not working on blog
I have got it working on normal page but on BlogApp it is not working is there.
<?php
if (perch_layout_has('blog-post')) {
perch_blog_post_meta(perch_get('s'));
perch_page_attributes();
}else{
echo '<title>' . perch_pages_title(true) . '</title>';
perch_page_attributes();
}
?>
<-- how the check works -->
<?php
perch_layout('header', array(
'blog-post' => true
));
?>
<?php
$post_slug = perch_get('s');
?>
On one its getting title and description from normal pages other getting from blog, however it is not doing it for blog. Is there something I done wrong? Whats the correct way? Whats the way forward
Hi Luke,
Is all this code in one file?
The section at the top should be in a Layout
templates/layouts/header.php
:This way when you use
perch_layout('header')
at the top of your page, the layouttemplates/layouts/header.php
will be included in the page.Hey, Hey the top section is in the header.php. the bottom section is in the post.php
What's in your
templates/blog/meta_head.html
?And is the blog post otherwise being displayed?
Posts are being displayed however i dont have blog/meta_head.html since my templates are coming from foundation zurb.
You are free to use any framework you want. You still can use Perch templates.
You are using:
The above uses
perch/templates/blog/meta_head.html
by default.You can find the default template in
perch/addons/apps/perch_blog/templates/blog/meta_head.html
.These are the contents of the meta_head
This looks like the default
post_meta.html
template which is used for editing.The default
meta_head.html
template is:Fixed, just had to put all code on the bot into the header php and it worked