Support » Plugins » Hacks » SEO friendly custom page URL for multi-page posts

  • Is it possible to use a SEO friendly custom url structure for multi-page (paginated) posts in WordPress?

    Example:

    This is the default url structure for paginated posts:

    category/post/2
    category/post/3

    etc.

    I want to change the url structure of paginated posts, to make them more SEO friendly, so instead of page numbers, the h3 title (that I manually add) of each subpages will be displayed in the url.

    For instance, if I add a h3 title ‘Test’ on the second page of the multipage post, then the following url structure will be generated for this page: category/Test

    And if I add a title ‘Test2’ on the third page of the multipage post, then the following url structure will be generated for this page: category/Test2

    Hopefully it’s clear what I’m trying to achieve.

    Any help would be much appreciated.

    Thanks in advance!

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    You should be able to get WP to parse such URLs correctly simply by hooking the ‘pre_get_posts’ action. There the category query var would be in place (using your example) as “test2”. Your code’s job would be to set the category query var as just “test” and additionally set the page query var as “2”.

    For more elaborate schemes you may need to use the Rewrite API to accomplish your goals.

    You would also need to filter the permalink template tags to output “category/Test2” instead of “category/Test/2. This too is possible. Which filter to hook varies by which template tags your theme uses, but ‘post_link’ is one possibility.

Viewing 1 replies (of 1 total)
  • The topic ‘SEO friendly custom page URL for multi-page posts’ is closed to new replies.