Forums

[resolved] Navigation on category pages appends category name problem (6 posts)

  1. joefletcher
    Member
    Posted 1 year ago #

    When I'm on a Category page (via archives.php template), my navigation menu changes - it appends the category name into the URL. Same with Tag pages. On other pages, the menu is correct. I have my permalinks set to /%postname% with no Category base or Tag base set.

    For example, normal menu URLs:

    example.com/about-us, example/contact-us.

    Once I navigate to any category page, the menu URLs change to:

    example.com/category-name/about-us, example/category-name/contact-us.

    And note, those categories aren't the categories of those pages - it's whatever category I happen to be on at that time.

  2. EMG
    Member
    Posted 1 year ago #

    Hi there!

    That's what it does for me, too, actually, and to be honest, I thought it was the normal thing to do because I figured people would like to see what category they are browsing and the category listing in the URL allows for bookmarking.

    I can't imagine what the URL might be otherwise because the URL markers where and what you are browsing. Since you're browsing through categories and tags, it's like you are browsing at a library and so the URL markers your spot where you're browsing.

    How would you prefer your category page to display?

    Maybe someone else here can help you write a loop to display a custom category URL.

  3. joefletcher
    Member
    Posted 1 year ago #

    I don't think that's exactly what my issue is. It's a bug somehow, b/c my menu URLs change depending on what page I'm currently on. The URLs should be static. They are links to pages.

  4. EMG
    Member
    Posted 1 year ago #

    Ohhh! I think I completely misunderstood a part of your original post - so sorry!

    So what you're saying is that in your site navigation, your static link URLs to let's say the About page and the Contact page changes when you start browsing categories or tags?

    example.com/about = example.com/categoryname/about?

    How are the navigational links coded into your theme?

    It sounds like there might be something wrong with how the links are encoded in.

  5. joefletcher
    Member
    Posted 1 year ago #

    Yep, you're right! I coded my links wrong. I coded href="about-us" instead of adding a / , so all I had to do was href="/about-us"

    What a dumb oversight.

    Thanks for your help!

  6. EMG
    Member
    Posted 1 year ago #

    I've done it myself (miscoding the link paths) before, but it involved links to images and not links links and I had to wrangle with that a bit myself.

    Glad you could find your problem and fix it and you are welcome! :)

Topic Closed

This topic has been closed to new replies.

About this Topic