Tagged: , ,

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #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

    #115981

    We 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;
    }

    #115982

    Hi,

    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

    #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

    #115984

    Hi!

    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

    #115985

    Hi,

    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

    #115986

    Hi 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

    #115987

    For 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

    #115988

    Hi 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

    #115989

    Since 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!

    #115990

    Glad that helped :)

    Let us know if you have any other questions or issues.

    Regards,

    Devin

Viewing 11 posts - 1 through 11 (of 11 total)

The topic ‘a real SEO problem: blog post title should be H1 header’ is closed to new replies.