Support » Fixing WordPress » Categories in URL

  • Is there a way to specifiy a primary category in WP, and use it in the URL?
    for example, somedomain.com/category/2004/32/post_title?
    Or if not a primary category, generate multuple ways of reaching that post:
    somedomain.com/category1/2004/32/post_title
    somedomain.com/category2/2004/32/post_title
    Currently, all my urls are of the above type, and I would prefer to keep them that way. Since everything in WP is dynamic, I see no reason why the above scheme should not be possible.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The problem would come from the fact that a post can be in multiple categories. So how would you choose which category to use for the permalink?

    Is it possible to “mark” one category as the primary, and use that one as the URL-generator?
    I would also be very interested in having categories in the URL. I have part of my personal site organized not by date, but by category. I do have a more “traditional” blog-type section which is archived by like categories and by week, but I don’t use individual archives in that section.

    To answer the above question, why not use all the categories? Have multiple urls pointing to a entry with multiple entries, as I said in the first post. After all, WP is a dynamic system, so why not get out of the habit of thinking about it statically – have as many pointers to an entry as you want.

    If you have multiple pointers to an entry, and you URL-ize the categories, search engines may take that amiss. Not a problem, perhaps, for those of us who are just playing around with personal sites (my own site is hardly part of the critical mass of entertainment on the web); but for any sites that want to attract traffic and have higher rankings, SE-friendly URLs are fairly important.
    Also, having a clear, logical, navigable site structure can be very helpful for users.

    So the solution then is marking one category as primary? I don’t know of any existing mod to do this, but someone should be able to hack it together.

    That was just a suggestion on my part. Someone with stronger programming-fu might have a better idea of how to implement this. (I might’ve accidentally suggested the kludgiest way to make this happen.)
    I don’t know if the first-selected category might be the “primary” category, or the category to be dirified; or if there would be a set hierarchy of syntax-like rules…which sounds even worse, in terms of programming. Getting into complex and user-defined syntax can give nosebleeds. It’s like university syntax courses all over again.
    (I feel a nosebleed coming on…)

    but for any sites that want to attract traffic and have higher rankings, SE-friendly URLs are fairly important.
    Also, having a clear, logical, navigable site structure can be very helpful for users.

    How would this not work, though? example.com/reviews/shrek-2/ – that makes perfect sense to me.

    Suppose I file a entry in two categories, books and reviews.
    Why not have two urls pointing to it:
    example.com/reviews/Catch-22/
    example.com/books/Catch-22/
    Both links are relevant. I don’t care if search engines take this amiss – this information is usefull to me. Or, if WordPress can have an option designating one category to be the primary – either which way. I think the above example could be implemented with not too much trouble, as it’s just a matter of taking the category from the database – the code should be the same as that of taking the post title and dirifying that.
    So can someone with a knowhow of php pls. comment on this? is it easily possible?

    Does anyone know if something has been done about this?

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Categories in URL’ is closed to new replies.