-
Notifications
You must be signed in to change notification settings - Fork 877
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Does't display %%page%% in single page with pagination #9669
Comments
@benvaassen It had no effect. The pattern of our |
Rel prev and rel next are also missing on the second page of your homepage, so I'm guessing we aren't picking up that it's a paginated post/page. The theme might also be overwriting our settings. It shows here there are specific settings for the homepage. Since it's a paid theme, I'm unable to investigate and reproduce this myself. Can you ask the theme developer for his thoughts on this? Or can you provide me with the theme? |
@benvaassen How do i send a template for you? |
If this helps: add_action( 'wpseo_head', 'rel_next_prev' );
function rel_next_prev(){
if (!is_page_template('page-blog.php')) {
return;
}
global $blog, $paged;
if ( $paged > 1 ) {
echo '<!-- add in wpseo_head hook --><link rel="prev" href="'.get_pagenum_link( $paged - 1 ).'" />'."\n";
}
if ( $paged < $blog->max_num_pages ) {
echo '<!-- add in wpseo_head hook --><link rel="next" href="'.get_pagenum_link( $paged +1 ).'" />'."\n";
}
}
add_filter( 'wpseo_canonical', 'yoast_edit_canonical' );
function yoast_edit_canonical( $canonical ) {
if (!is_page_template('page-blog.php')) {
return $canonical;
}
global $paged;
return get_pagenum_link( $paged );
} In my opinion, this indicates that the WordPress recognizes this page as a page of pagination ( |
@benvaassen I suspect the problem here: wordpress-seo/frontend/class-frontend.php Lines 567 to 571 in 9d2ba28
As far as I can judge by looking at the code, If the home static page is being processed, the variables have the following status: $modified_title // true
empty( $title ) // false
!empty( $title_part ) // false Because of this, the presence of paging is ignored |
Thanks for the elaborate replies. I've labeled it as |
I have the same problem. Are there some ideas? |
I have the same issue on a "is_simple_page()", stated on line 439 of class-frontend.php. Removing these lines will add the page number. ` elseif ( $this->frontend_page_type->is_simple_page() ) {
Any news on this issue? Is there a workaround for this? |
Looks like pages use the get_current_post_page_number method in the Pagination_Helper class which only checks for the 'page' query_var and not 'paged'. So if you have any page with a custom query that applies pagination the titles and canonicals will be incorrect. Ideally the get_current_post_page_number method would check for the 'page' query_var and then check for the 'paged' query var. Or pages should make use of the get_current_page_number() method instead which appears to only be used for breadcrumbs but not the title or the canonical. |
This is still an issue. The static page being used for the home page is a single page. Because %%page%% was being ignored, I tried to force it with: %%title%% %%sep%% Page %%pagenumber%% of %%pagetotal%% This rendered the Title Page as: /page/2/ So yeah, it still needs to be fixed... |
@smkrause - Here is class I currently use in my Total theme for a fix if you want to check it out: ps: It fixes the title and also the canonical which may also be incorrect.
|
@wpexplorer Thank you! Now custom loop on the page shows page numbers in title. Is it possible to add page number to breadcrumbs to? |
@Slamik - Personally I hide the end title from the breadcrumbs because it's basically just duplicate text since your page should have an h1 with the title, no point in adding it to the crumbs. But I'm sure you could hook into the "wpseo_breadcrumb_single_link_info" hook to modify the output of the title. |
Please give us a description of what happened.
In my template, the main page is a static page. However, this page has a history of degeneration.
is_paged()
returntrue
However, the plugin does not add to the
<title>
information about the paging as it does in the archivesPlease describe what you expected to happen and why.
The page https://ihappymama.ru/category/soveti/page/2/
Has title "Архивы Полезные советы ~ Страница 2 из 78"
Title template for
category
— Архивы %%term_title%% %%page%%I was expecting the title of the main page to have the same behavior https://ihappymama.ru/page/2/
"Я happy МАМА ~ Страница 2 из 356" — expected
<title>
"Я happy МАМА" — real
<title>
Title template for
page
— %%title%% %%page%%Technical info
The text was updated successfully, but these errors were encountered: