How do I get rid of the /category/number in my URLs?



  • Hello nodeBB Community 🙂

    All my paths show up as: www.domain.com/category/2/[Category_Name], where instead, they should be www.domain.com/[Category_Name]. I want to kill this hooey part of URLs! How can I get rid of that?

    www.community.nodebb.org/category/11/games
    www.community.nodebb.org/category/12/random
    www.community.nodebb.org/category/6/bug-reports
    www.community.nodebb.org/category/1/announcements


  • That would give serious issues if you had two posts with the same title.



  • @reaon
    I think that hooey part is part of what gives a post its unique URL. Every category has to have an ID.


  • Admin

    Hey @reaon -- that's as pretty as you're gonna get it, I'm afraid! We need that number in there because it's the cid, and that's the important part. You'll note that if you omit the category name, it'll still take you there (and re-append the category name in the URL). In essence, the name in the URL is there to look pretty, and for SEO value.

    Same with topics.



  • @Sp4rkR4t said:

    That would give serious issues if you had two posts with the same title.

    What will happen for topics with the same title in: www.community.nodebb.org/category/1/announcements ?

    I want to change www.community.nodebb.org/category/1/announcements to this: www.community.nodebb.org/announcements!
    www.community.nodebb.org/announcements will still be unique, won't it?

    @julian said:

    Hey @reaon -- that's as pretty as you're gonna get it, I'm afraid! We need that number in there because it's the cid, and that's the important part. You'll note that if you omit the category name, it'll still take you there (and re-append the category name in the URL). In essence, the name in the URL is there to look pretty, and for SEO value.

    Same with topics.

    I didn't get what you said. may you clarify that a little 🙂



  • @reaon Basically the cid is what takes you to announcements, not URL/announcements.

    For example.

    www.community.nodebb.org/category/1/announcements
    would take you to announcements.
    www.community.nodebb.org/category/1
    would also take you to announcements.

    The number is the key bit to how you end up where you want to go.


  • Admin

    @reaon If I'd named two categories the same thing, then it'd be impossible to know which one users want to go to! 🙂



  • @a_5mith said:

    The number is the key bit to how you end up where you want to go.

    ok, what about keeping number and removing the word category?

    @julian said:

    @reaon If I'd named two categories the same thing, then it'd be impossible to know which one users want to go to! 🙂

    Why should you want to choose same name for both of them?! The system should show up error massage in this case!

    Isn't there any method for having clean URL for categories? .httaccess?!



  • @reaon The reason category is on the end is for SEO purposes. As Google can't work out what your category is by the number.


  • Plugin & Theme Dev

    end

    @reaon So just reiterating on what everyone is saying, you will need those numbers, as @julian said.
    There's no changing it unless you're willing to modify the core, in which case things will get pretty messy.



  • This post is deleted!



  • Admin

    If you do specific rewrites for each category, then yes, I believe that could work. However, our internal links will always still contain the slug.



  • Does htaccess work for nodeBB? (As I searched it seems it's specified for Apache web server!)



  • I agree that the /category/ slug is not useful at all. Not useful from a Usability perspective and not useful from a SEO perspective.

    I think it should be better something like /announcements-1/ or /1/announcements/ or /announcements/1/ without adding the /category/.

    And also for topic I don't think there a real utility in adding /topic/ in the URL.

    In any case it's a small issue from an SEO perspective.

    But why not putting a URL value in the database for the categories to get rid of the id and the /category/ slug?



  • @andreapernici said:

    I agree that the /category/ slug is not useful at all. Not useful from a Usability perspective and not useful from a SEO perspective.

    (...)

    But why not putting a URL value in the database for the categories to get rid of the id and the /category/ slug?

    I agree, and to add to this: the /category/ and /topic/ slugs look a little bit weird on non-English installs of NodeBB. It would be nice if we can drop these for translation consistency.

    I don't mind the number in the url; that is also helpful if two topics share the same name.

    (Just wondering, is there an update for this request? 🙂 ).


 

| |