Sort topics (within category) in alphabetical order by default

(Pieter Kubben) #1

I know that the issue has been discussed before and some progress has been made (and that many disagree that alphabetic sorting on topic title is useful), but to me it is. I am experimenting with Discourse to see if I can use it to replace which contains neurosurgical classification and grading systems. The option that users can add their own classifications (and more) and discuss them on site is a great side benefit. Primarily however, I want users to go to categories easily and find the content they are looking for.

I managed to get the categories view first when accessing, and modified @sam’s Minimal Topic List Design to allow the user to sort topics in alphabetical order by changing this piece in the header :

<script type='text/x-handlebars' data-template-name='topic-list-header.raw'>
    {{raw "topic-list-header-column" sortable='true' order='topic.title' name='topic.title'}}

This works, but the user still has to perform the sorting manually. How can this be done as a default setting when the category is opened?

Side note: I also changed

{{raw "topic-list-header-column" sortable='true' number='true' order='replies' forceName='Replies'}}

(in the original post it said order='posts' and it gave some side effects, guess that is a typo)

Any help would be greatly appreciated!


Sort topics within category by topic title
(Jeff Atwood) #2

I think if you “need” to sort by title there is something wrong with your approach. As in, you should be using categories or tags for that information rather than embedding it in the title as a string.

(Pieter Kubben) #3

That depends, I guess… If someone wants to “browse” through a certain category it may be helpful if the content is sorted. Otherwise a topic may be at a different position everytime.

I realize this is not the main purpose of Discourse, but to me the lack of it is currently holding me back of proceeding. Fortunately you also offer categories as JSON in which I can do sorting to create some mobile version myself, but I prefer not to. :wink:

(Mittineague) #4

It would probably be easy enough to sort by title except for one problem - endless scroll.

So do an alpha sort in batches of 30?

Wouldn’t it be better to use Search?

(Pieter Kubben) #5

Depends… for very large categories, yes. But if a specific category is restricted regarding adding new content, no.

(dosch) #6

We have a category explaining terms; a dictionary. Here alphabetic sorting would be handy to quickly scroll to the right term.
Why is endless scrolling a problem…? Couldn’t you just start with ‘A’ and load ‘B’ as the user scrolls down?

Or is the problem that the list can’t be made because to the browser not all topics are known yet, before the user scroll down?

(Mittineague) #7

I think using Tags would be the far easier way to present alphabetically grouped lists, else The Search feature.