WordPress.org

Ready to get started?Download WordPress

Forums

Next Page..SEO/Title (4 posts)

  1. complexity
    Member
    Posted 3 years ago #

    <?php wp_link_pages(array('before' => '<p>Pages: ', 'after' => '</p>', 'next_or_number' => 'number', '', '')); ?>

    Ok. When you make pages with <next page> within a post. All of the pages have the same title which is bad as we know. I can't figure out a way to add - page 2, etc. in the title. I heard it could be done with $paged, but I haven't found anything on it.

    But I went through on google to check, and none of my pages are even added on any of the search engines if they have more than one page. I'm wondering if anyone else has this problem and doesn't that make a lot of content that's not on search engines that could be?

    I don't really want to split up them articles all into separate posts but I think that's my only option.

    Any ideas?

  2. alchymyth
    The Sweeper & Moderator
    Posted 3 years ago #

    does none of the seo plugins take are of this?

    if so, you could hack the code and find out how they do it.

    i succeeded with this snippet, which seems a bit complicated, to get the values of $numpages and $page in the <title> tag in header.php:

    <title>HERE YOUR OTHER CODE TO SHOW THE PAGE/POST TITLE AND SO
    <?php if(is_singular() ) {
    if(strpos( $post->post_content, '<!--nextpage-->' )) {
    setup_postdata($post);
    global $page; global $numpages;
    echo 'page '.$page.' of '.$numpages'; }
    } ?>
    </title>
  3. complexity
    Member
    Posted 3 years ago #

    That surely looks like it could work, it gives a parse error though.

  4. alchymyth
    The Sweeper & Moderator
    Posted 3 years ago #

    a little quotation mark in excess here at the end:
    ...numpages'; }

    corrected:

    <title>HERE YOUR OTHER CODE TO SHOW THE PAGE/POST TITLE AND SO
    <?php if(is_singular() ) {
    if(strpos( $post->post_content, '<!--nextpage-->' )) {
    setup_postdata($post);
    global $page; global $numpages;
    echo 'page '.$page.' of '.$numpages; }
    } ?>
    </title>

    didn't give an parse error in my test, however, most parse errors are from incorrect nesting of php and html tags.

    you could post the snippet within the context of your head section of header.php.

Topic Closed

This topic has been closed to new replies.

About this Topic