admin管理员组

文章数量:1125003

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!

本文标签: How to create archive child pages with good Yoast SEO meta