• Resolved mjchecko

    (@mjchecko)


    Saw this question unanswered in a couple topics.

    I have several parent categories (actor, director, etc.) each with a long list of child categories (names e.g. Tom Cruise). I’m trying to get Yoast to include both parent and child categories in the slug for a category page (website.com/actor/tom-cruise) but it won’t do it, only including the child category (website.com/tom-cruise).

    I do have “remove the categories prefix” enabled (“remove”) but ran a test with it disabled (“keep”) and it didn’t solve my problem – only added “category” (website.com/category/tom-cruise).

    For what it’s worth, both URLs actually work (with and without the parent category) so I can solve my problem using a redirect to my preferred URL, but I’m wondering if this affects SEO especially when Yoast is preferring the “child category only” URL it shows in the Snippet Editor.

    ? latest WordPress installed
    ? latest Yoast and all other plugins
    ? WP permalink settings are custom and include category.

    What am I missing? Thanks.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support Michael Ti?a

    (@mikes41720)

    Hi,

    The ‘remove the categories’ prefix will only work to remove the ‘category’ wording from your permalinks, but wouldn’t affect the display of parent or child categories in the permalinks. You can learn more about it here — https://yoast.com/help/how-to-remove-the-categories-prefix/

    Could you please let us know what your permalink structure is in your WordPress dashboard > Settings (sidebar) > Permalinks? We’re not sure if this is an issue with the Yoast SEO plugin and more on the permalink structure you are using. If you select the child or subcategory, it should also include the parent category in the permalinks if configured correctly. This article may be of help with regards to the proper setting of your permalinks.

    Thread Starter mjchecko

    (@mjchecko)

    Thanks, Michael.

    My permalink settings: https://website.com/%category%/%postname%/

    I’m set-up per the info in the links you shared.

    This seems to be something isolated to just category pages. Everything works as it should for posts: WP includes the parent and sub categories in the URL.

    Also, I wondered: all the posts are categorized with a child category but not the parent. (So: tom-cruise not actor + tom-cruise) so the parent categories actually have 0 count. To see if this might be causing problems, I added the parent category to the posts… but it didn’t do anything to help solve my problem. Oh well.

    LMK if you have any other ideas to check!

    Plugin Support Michael Ti?a

    (@mikes41720)

    Hey,

    We did test this on our test site, and upon viewing both of the parent and child category page, the permalink structure was correct. Perhaps it’s something you may have to test further with your own WordPress set-up.

    If you have any other questions or concerns about the Yoast SEO plugin itself, please do let us know.

    Thread Starter mjchecko

    (@mjchecko)

    Thanks, Michael.

    Just to confirm: in your test, when you look at the Yoast dashboard on the edit / admin page for the child category, does it show the slug as just the child? Or does it show parent/child?

    For me, both versions of the link actually do work on the live site:
    https://www.mysite.com/child-category/
    https://www.mysite.com/parent-category/child-category/

    But the Yoast dashboard only shows the link/slug as:
    https://www.mysite.com/child-category/

    I’m trying to understand if Yoast will be optimizing this child-only version as the preference, or if it’s simply just how the dashboard (confusingly) presents it.

    Right on – thanks again.

    Plugin Support devnihil

    (@devnihil)

    @mjchecko On my own test site, for the child category, the slug only shows the child category name in the slug.

    In regards to having the /child-category/ and /parent-category/child-category/ issue, whereas both versions of the URL work, if you view the source code for /child-category/ you’ll see the canonical value for the page is pointing to /parent-category/child-category/ so these aren’t going to be seen as two separate but duplicate pages by a search engine.

    Thread Starter mjchecko

    (@mjchecko)

    That’s it! Thanks @devnihil

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Category page slug only showing child category, not parent category’ is closed to new replies.