I want to create children pages to some archives on wordpress with Yoast SEO.

Today, i have /tags/{tagName} and i want to add sub pages to this archive.

The goal is to have:

  • /tags/{tagName} main tag page with some infos
  • /tags/{tagName}/news with a list of post
  • /tags/{tagName}/videos with a list of custom post type
  • /tags/{tagName}/bios with a list of custom taxonomy

Each children need to get his own yoast seo meta (title, description, canonical) to not have duplicate metas.

How can i archive this ?

My idea was to add rewrite rules to add these slugs to archive pages:

/tags/({$post_type_nicename})/news/?$ => index.php?post_tag=$matches[1]&sub_page=news

/tags/({$post_type_nicename})/news/{$wp_rewrite->pagination_base}/?([0-9]{1,})/?$ => index.php?post_tag=$matches[1]&paged=$matches[2]&sub_page=news

And use sub_page query var to know on wich sub page i am. But, with this kind of solution, yoast seo metas are the same on each page.

Thank you!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.