• Resolved ralesasa34

    (@ralesasa34)


    Hi,

    Is there a way to make every pagination page to have unique meta descriptions and meta titles? For an example /blog/page/2/ shoud have unique title an description by adding Page number to description and title. I found this script:

    add_filter(‘rank_math/frontend/title’, ‘blog_multipage_title’,100,1);

    I added it but it does not work. Can you please help? Am I doing something wrong? Thanks.

    • This topic was modified 1 year, 8 months ago by ralesasa34.

    The page I need help with: [log in to see the link]

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Support Rank Math Support

    (@rankmathteam)

    Hello @ralesasa34,

    Thank you for contacting the support.

    You can use the %page% or%pagenumber% variable in the title & description to add the page number and make them unique. You can set a global template for the title & description from WP Dashboard > Rank Math > Titles & Meta: https://rankmath.com/kb/titles-and-meta/#post-types

    Hope that helps.

    Thread Starter ralesasa34

    (@ralesasa34)

    Hi,

    Thanks for your answer. I tried to use variables %page%?or%pagenumber% but also they are not working. Can you please check the code I sent to you first? Thanks.

    Plugin Support Rank Math Support

    (@rankmathteam)

    Hello @ralesasa34,

    The code you shared is calling a function called “blog_multipage_title” but you haven’t shared the code of that function for us to check.

    The code just by itself without that function getting called doesn’t do anything on the website.

    Looking forward to hearing back from you.

    Thread Starter ralesasa34

    (@ralesasa34)

    Hi,

    thank for you answer. The code I shared with you is the code I found on your forum, so somebody from your team shared it. Is there a chance that you check do you have some custom snippet for duplicated meta description and duplicated meta titles for pagination pages? I tried to use variables, but they are just printing me number “1” next to meta description and next to meta title on paginated pages. I am sorry, I would realy appreciate your help.

    Thanks in advance.

    Thread Starter ralesasa34

    (@ralesasa34)

    Thread Starter ralesasa34

    (@ralesasa34)

    Hi,

    Can you please check my last message? Thanks.

    Plugin Support Rank Math Support

    (@rankmathteam)

    Hello @ralesasa34,

    The %page% variable will add Page x of n in the meta title & description. So it is better to use the variable instead of the filter as that is also going to do a similar thing for the SEO title.

    However, if you still want to use the filter, you should use the following code:
    function blog_multipage_title($title) { global $page; $paged = get_query_var(‘paged’) ? get_query_var(‘paged’) : 1; !empty($page) && 1 < $page && $paged = $page; $paged > 1 && $title .= ‘ | ‘ . sprintf( __(‘Page %s’), $paged ); return $title; } add_filter(‘rank_math/frontend/title’, ‘blog_multipage_title’,100,1);

    Hope that helps. Let us know if you need any other assistance.

    Plugin Support Rank Math Support

    (@rankmathteam)

    Hello @ralesasa34,

    Also, if you look carefully at the URL you’ve shared, the user has already shared a similar function with us, like this one:
    function blog_multipage_title($title)

    Here’s a screenshot for your reference: https://i.rankmath.com/i/fuud9N

    Basically, you’ll need to create a function first, and then you can call the function with our filter.

    Hope that clarifies your doubt. Thank you.

    Thread Starter ralesasa34

    (@ralesasa34)

    Hi thanks for your answer. I edited tyour code little and it works:

    function blog_multipage_title($title) { global $page; $paged = get_query_var(‘paged’) ? get_query_var(‘paged’) : 1; if ( !empty($page) && 1 < $page ) { $paged = $page; } if ( $paged > 1 ) { $title .= ‘ | ‘ . sprintf( __(‘Page %s’), $paged ); } return $title; } add_filter(‘rank_math/frontend/title’, ‘blog_multipage_title’, 100, 1);

    Is there a code for making unique meta descriptions on paginated pages? This one that I did is only for titles. Thanks in advance.

    Plugin Support Rank Math Support

    (@rankmathteam)

    Hello @ralesasa34,

    We have a similar hook for the description that you can check here:
    https://rankmath.com/kb/filters-hooks-api-developer/#change-meta-description

    You can create a similar function to that adds a slightly different code to each meta description for paginated pages.

    Don’t hesitate to get in touch if you have any other questions.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Unique Meta Titles and MEta Descriptions for pagination pages’ is closed to new replies.