-
AuthorPosts
-
April 26, 2013 at 8:11 am #22496
Hi,
every post gets a H1 header “Blog” and the post title is H2 on single blog post pages. As you know, that’s bad for ranking….
Thank you for a quick solution.
Bernt
April 26, 2013 at 9:36 am #115981We added a new filter to the avia_title function which allows you to change the title on the single post page. I.e. add following code to functions.php:
add_filter('avf_title_args', 'fix_single_post_title', 10, 2);
function fix_single_post_title($args,$id)
{
if ( is_single() )
{
$args['title'] = get_the_title($id);
}
return $args;
}to display the post title instead of “Blog”.
If you want to remove the h2 title on single pages (to avoid duplicate content) use following filter function – just add it to functions.php:
add_filter( 'post-format-standard', 'fix_blog_post_title' );
function fix_blog_post_title($current_post)
{
if(is_single()) $current_post['title'] = '';
return $current_post;
}April 26, 2013 at 10:07 am #115982Hi,
thank you, this resolves most of this issue.
It displays the post title instead of “Blog” now, but the permanent link is pointing to the blog page and not to the single post…
Is there a way to handle that correct?
Regards,
Bernt
April 26, 2013 at 10:19 am #115983… OK, I added get_permalink($id) to the link argument.
function fix_single_post_title($args,$id)
{
if ( is_single() )
{
$args['title'] = get_the_title($id);
$args['link'] = get_permalink($id);
}
return $args;
}Regards,
Bernt
April 26, 2013 at 11:23 am #115984Hi!
Yes – you can also remove the link with:
$args['link'] = false;
– imho this link doesn’t make much sense anyway if it points to the current page url…
Best regards,
Peter
April 26, 2013 at 11:33 am #115985Hi,
yes, I tried both options. Not shure what’s better for SEO, but I think I will remove the link as less is more…
Thanks,
Bernt
April 26, 2013 at 12:36 pm #115986Hi Bernt,
Glad you were able to get things to your liking. SEO is a complicated subject and there isn’t really a right answer anymore these days. Even using multiple H1 on a page is completely fine and it has more to do with the html structure of where they are than having a single h1 per page.
The most important thing is having accurate and relevant content for the site topic and the search engines will do the rest :)
Regards,
Devin
April 26, 2013 at 4:18 pm #115987For various reasons, I don’t want to display the header with the page title (or the post title) on single pages. So, I have hidden it using css.
Would it also be possible to simple use a h1 tag for the post title? I tried to achieve that by changing h2 to h1 for the standard post format in helper-post-format.php, but that didn’t get me anywhere.
Cheers,
Sander
April 27, 2013 at 4:40 pm #115988Hi Sander,
That should be the only spot you need to change it but you can also always control the display of that header information from the Layout meta box on each page/post using the dropdown for Header.
Regards,
Devin
May 4, 2013 at 1:03 pm #115989Since the 1.4 update, you can override functions from helper-post-format.php in your child theme. That makes it possible to define your own markup for post titles.
Problem solved. Thanks!
May 4, 2013 at 2:02 pm #115990Glad that helped :)
Let us know if you have any other questions or issues.
Regards,
Devin
-
AuthorPosts
- The topic ‘a real SEO problem: blog post title should be H1 header’ is closed to new replies.