Please make category url shorter

( hey_julien) #1

The category url includes the name ‘category’ which is long to type and only work in english. May it be replaced by /c/ or something custom ?

Removing the word /category/ from categories URLs?!
URL shortening service support
Control of URL structure
(Jeff Atwood) #2

I am curious about this, because “it’s too much English” applies to so many URLs in Discourse already.

Should /user/ be /u/? Should /new/ be /n/? I can go on… tons of URLs are de-facto English and cannot sanely be localized.

Titles should have emphasis in topics, and topic titles are quite long. But category names should not be long. I think the clarity of /category/dogs is more important than brevity here.

( hey_julien) #3

I agree with the clarity argument, i’m also thinking about the way a user may access his favorite category, in this situation i think shorter is better. Maybe this is the same reason you choose /t/ for thread. The example of reddit works pretty well too with /r/. Could we allow both path ? /category/ and /c/ ?


Im hoping for the ability to change permalink structure like the way its possible in Wordpress :slight_smile: If thats not going to be possible, i will vote for /c and /u over /category and /user.

(Sjors) #5

Wordpress does this by adding a .htaccess file for apache to read, so permalinks on wordpress are handled on server level not in wordpress itself. Changing the permalinks should be possible with the nginx rewrite module.


Can anyone post nginx rewrite rules on how to change /category/ to /c/ ?

(David_Heidrich) #7

Rewriting server-side would not be effective, because ember relies on location to reflect the propper route.

(sparr) #8

If Discourse reaches enough penetration that people recognize its path schema then /u/ and /c/ won’t be any more cryptic than /u/ and /r/ are on reddit

(nXqd) #9

I think it’d be nice that we can have a custom route for a specific need.

(jon r) #10

We were also disussing this question in a GitHub issue recently. If you want to have a look or participate.

(Kane York) #11

That’s a different issue - how if, when the category name is stripped to be html-safe, it’s empty, that the slug defaults to {id}-category.

This topic is about replacing /category/{id}-{slug} with /c/{id}-{slug}.

(jon r) #12

As of my comment there, I’m also proposing to change from /category/ to /c/:

You don’t like how the url looks? It isn’t a malformed url. We have to use the id in the url for category names that use non-latin characters

Yes, I find it rather confusing that the IDs of topics are seperated by a / where categories use -.
Also is the order different : categories have a leading ID, whereas topics have a trailing one.

/category/11-category/ > /c/networking/11/ (Title would have been networking~)

Why not switching to a more consistent scheme?
Changing that would allow to have the remaining latin characters in the URI and thus rendering it human-readable.

I admit it’s not the original topic and came up in the investigation.
Also the different :slug schemes are again another question.

(Sam Saffron) #13

I think we should make a call here.

our options are

  1. Introduce an alias /c/ for parity with /t/
  2. Move everything to /c/
  3. Make the URL locale dependent
  4. Close this.

(Jeff Atwood) #14

Personally I would rather do #2 at this point. Category is a long word and shorter urls are better.

(cpradio) #15

Wouldn’t that potentially require rebaking all posts (in case their is a link to a category)?

(Sam Saffron) #16

Nope, I will set up a permanent redirect, eventually everything will be rebaked (when we make breaking changes to markdown)

(Kane York) #17

How about /u/ while we’re at it? :stuck_out_tongue:
(though Reddit redirects /u/ to /user/ instead of the other way around), which is… weird, I guess.)

(Sam Saffron) #18

nope, we are leaving user for now.

(cpradio) #19

Just because I feel a bit dense, but does that mean /c/ will redirect to /category/ ?

The reason I ask, is I’m trying to put the Dismiss Posts/Topics/New button on category pages and I need to figure out what category I’m on. Right now I’m using this.get(‘filter’) and grabbing the category from that.

(Jeff Atwood) #20

Well, user pages are excluded from indexing by default in robots.txt so those pages are a bit less important.

# See for documentation on how to use the robots.txt file
User-agent: *
Disallow: /auth/cas
Disallow: /auth/facebook/callback
Disallow: /auth/twitter/callback
Disallow: /auth/google/callback
Disallow: /auth/yahoo/callback
Disallow: /auth/github/callback
Disallow: /auth/cas/callback
Disallow: /assets/browser-update*.js
Disallow: /users/