Mentioning Categories instead of Groups?

Wouldn’t it be more like topics? eg.

https://meta.discourse.org/c/:slug/:id

1 Like

I’m guessing the tricky part is the fact that there is a separate path parameter for subcategories.

So you currently have these two routes:

1. https://meta.discourse.org/c/:category_slug
2. https://meta.discourse.org/c/:category_slug/:subcategory_slug

If you append :id to the end of each you end up with:

A. https://meta.discourse.org/c/:category_slug/:id
B. https://meta.discourse.org/c/:category_slug/:subcategory_slug/:id

But now A looks a lot like 2, so this would break backward compatibility unless you add some heuristics in the A route to say something like “if :id is not a number, try matching it to a subcategory instead.”

That’s the best option I’ve come up with so far (with my limited knowledge of how the Rails and/or Ember routers work).

1 Like

Ok I just added support for links which uses the category ID instead but at the same time still keeping the slug in the link.

https://github.com/discourse/discourse/commit/d523dd320809d93f01705de9ea72a5852ddc42f2

#howto —> meta.discourse.org/c/4-howto
#tips-and-tricks —> meta.discourse.org/c/how-to/tips-and-tricks/5

8 Likes

Just thought of a possible improvement for the sake of consistency. Instead of:

#howto ---> meta.discourse.org/c/4-howto

How about:

#howto ---> meta.discourse.org/c/howto/none/4

Or:

#howto ---> meta.discourse.org/c/howto/all/4

#howto ----> meta.discourse.org/c/howto/4 is possible but we already have code that handles 4-howto which I think works just as well.

Just noticed this great new feature, but I’m not sure if # is exactly the right way to mention a category…

Maybe we could use /category_name or /c/category_name and keep the hashtag reserved for tags or some other future #hashtag feature?

The other way it breaks down is when you try and say

#support is the most popular category

1 Like

You need to add a space before the # if it is at the start of a new line, otherwise it is treated like a header.

Edit: Clarity

3 Likes

I do LOVE the idea of allowing users to subscribe and get notified to a #hashtag, but also don’t want a bunch of extra categories that don’t really need their own category.

I think something similar to the current discourse-tagging plugin might work better - admin can create a list of useable hashtags and select which groups/trust_levels can use them.

Plus it would also be great to be able to browse all the #hashtags like we can with tags (e.g. /tags/tag_name), but display the individual posts instead of just the topics.

@mr8, not following your post here. There are no new categories being made here. All this does is allow current categories to be mentioned via a #, like #feature.

3 Likes

I, for one, am very much liking the current implementation.

That said, I think it could be expanded to allow tag mentions too though… how many places will have namespace collisions with category names and tag names? A different styling could be applied to differentiate whether the link were going to a tag vs. a category.

5 Likes

Mm, I don’t know what I’d replace it with but I’m not crazy about the shared syntax. Or rather that the category-mention syntax is technically space+hashtag and not just hashtag, just feels unusually clunky.

I guess it’s a minor stumbling block overall though, I like the feature otherwise. :slightly_smiling:

I have no idea what you are talking about. It is not space plus hashtag. Just like other forms of autocompletion, it does not work in the middle of words, e.g.

Hey@yuun
That’s funny:)

Nobody expects those to work, does not mean “space plus”.

1 Like

Referring to the case mentioned above with header syntax - category mentions don’t work at the start of a line, while other forms of autocomplete do.

e.g.:

@codinghorror: this mention works fine
#howto: this doesn’t
#howto: because it needs a space


@codinghorror: this mention works fine
#howto: this doesn't
 #howto:  because it needs a space

Space+hashtag was probably a clumsy way of putting it, this is all I’m really referring to here - that it conflicts with the header syntax. It’s an edge case, I guess? I think the most natural use of the category-mention isn’t really at the start of a line, but there it is.

1 Like

I follow but I am not sure this is a solvable problem :frowning: … until we move to the new CommonMark engine.

Already reported this “bug”…@tgxworld said it was not a bug.

2 Likes

Ah apologies I didn’t catch that. If the header syntax is changing at some point then there isn’t a conflict (or well, not a permanent one).

Sorry for the mix-up. :slight_smile:

2 Likes

Yeah, I find myself wanting to see the category’s current color chip / badge next to the link.

e.g. #howto should display as , not

Probably best done as a decoratePost() trigger, with #category getting a class on the link that the decorator selects on.

11 Likes

Isn’t it solved once the CommonMark spec is finalized and adopted?

Should space be required after # in ATX headers? (MUST)
(Leaving this as it already is - spaces are required.)

1 Like

Yes, I added a markdown-it-review tag there so we can sort it out when we make the move

3 Likes