# When in a category, default to "none" rather than "all" subcategories

**URL:** https://meta.discourse.org/t/when-in-a-category-default-to-none-rather-than-all-subcategories/26173
**Category:** Support
**Created:** [3월 10, 2015, 4:40오후 UTC](https://meta.discourse.org/t/when-in-a-category-default-to-none-rather-than-all-subcategories/26173 "2015-03-10T16:40:49Z")
**Posts on this page:** 17
**Page:** 1

<div class="post-metadata">

### Author: ![tobiaseigen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tobiaseigen/32/539204_2.png) [@tobiaseigen](https://meta.discourse.org/u/tobiaseigen)
#### Post date: [3월 10, 2015, 4:40오후 UTC](https://meta.discourse.org/t/when-in-a-category-default-to-none-rather-than-all-subcategories/26173/1 "2015-03-10T16:40:50Z")

</div>

I’d like to find a way to default the view for all users to display “none” rather than “all” subcategories, when in a category. “all” would be an option they could select. Is there any way to achieve this?

Generally, my community is finding “none” as an option to select unintuitive.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [3월 11, 2015, 3:33오전 UTC](https://meta.discourse.org/t/when-in-a-category-default-to-none-rather-than-all-subcategories/26173/2 "2015-03-11T03:33:27Z")

</div>

I think you are looking for the checkbox to limit display of subcategories within a category; this already exists.

---

<div class="post-metadata">

### Author: ![tobiaseigen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tobiaseigen/32/539204_2.png) [@tobiaseigen](https://meta.discourse.org/u/tobiaseigen)
#### Post date: [3월 11, 2015, 4:03오전 UTC](https://meta.discourse.org/t/when-in-a-category-default-to-none-rather-than-all-subcategories/26173/3 "2015-03-11T04:03:39Z")

</div>

No - that’s totally different. When you display subcategories it looks more like a categories page. I like the list of topics, but just want to see the list of topics for the category (none), not for the category plus subcategories (all).

---

<div class="post-metadata">

### Author: ![Maestra\_Powers](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/maestra_powers/32/37362_2.png) [@Maestra\_Powers](https://meta.discourse.org/u/Maestra_Powers)
#### Post date: [3월 14, 2015, 7:26오후 UTC](https://meta.discourse.org/t/when-in-a-category-default-to-none-rather-than-all-subcategories/26173/4 "2015-03-14T19:26:16Z")

</div>

Fixed it via JS. You have to add this code to your head.

```
// For categories list
$(document).on('mouseover', 'td.category div.pull-left a', function() {
    // do it only once
    if ($(this).hasClass('link-fixed')) {
        return;
    }
    
    // do it only if there's subcategories
    if ($(this).parents('td.category').find('div.subcategories').length) {
        var link = $(this).prop('href');
        $(this).prop('href', link+'/none');
    }
    
    $(this).addClass('link-fixed');
});

// For dropdowns
$(document).on('click', 'ol.category-breadcrumb li', function() {
    // do it only once
    if ($(this).hasClass('links-fixed')) {
        return;
    }
    
    // do it only for first dropdown
    $(this).addClass('list-clicked');
    if (!$('ol.category-breadcrumb li').slice(0, 1).hasClass('list-clicked')) {
        $(this).removeClass('list-clicked');
        return;
    }
    $(this).removeClass('list-clicked');
    
    // you can't check subcategories from here, so doing it for all
    $(this).find('section.category-dropdown-menu div.cat a').each(function() {
        if (!$(this).hasClass('home')) {
            var link = $(this).prop('href');
            $(this).prop('href', link+'/none');
        }
    });
    
    $(this).addClass('links-fixed');
});

// For breadcrumbs when reading a topic
$(document).on('mouseover', '.title-wrapper .ember-view a', function() {
    // do it only once
    if ($(this).hasClass('link-fixed')) {
        return;
    }
    
    // do it only for first button
    $(this).addClass('list-clicked');
    if (!$('.title-wrapper .ember-view a').slice(0, 1).hasClass('list-clicked')) {
        $(this).removeClass('list-clicked');
        return;
    }
    $(this).removeClass('list-clicked');
    
    var link = $(this).prop('href');
    $(this).prop('href', link+'/none');
    
    $(this).addClass('link-fixed');
});

```

I don’t think this will work on phones. There’s probably no such events as “mouseover”.

---

<div class="post-metadata">

### Author: ![Yuun](https://avatars.discourse-cdn.com/v4/letter/y/977dab/32.png) [@Yuun](https://meta.discourse.org/u/Yuun)
#### Post date: [4월 28, 2015, 2:34오전 UTC](https://meta.discourse.org/t/when-in-a-category-default-to-none-rather-than-all-subcategories/26173/5 "2015-04-28T02:34:38Z")

</div>

Wanted to say thanks for the JS fix Maestra, and make a small contribution:

The above JS works 99% of the time, but a user found that when they clicked on the little unread notification in the categories list, it took them to a page that doesn’t exist. E.g., for [meta.discourse.org](http://meta.discourse.org) they’d end up here: [https://meta.discourse.org/c/feature/l/unread/none](https://meta.discourse.org/c/feature/l/unread/none).

The minor edit I used to fix this is to slap the following at the top of your first section of code for the categories list, right after the if: ‘link-fixed’ bit.

```
var ignore = /(unread|new|top)/
//ignore unread, new, top links
if(ignore.test(this.getAttribute('href'))){
    return;
}

```

The ‘top’ part might not be necessary in retrospect, but whatever it doesn’t hurt anything.

edit - I suppose more sophisticated regex might be in order if one of your categories has “new”, “unread”, or “top” in the name, though.

---

<div class="post-metadata">

### Author: ![Fred\_vom\_Jupiter](https://avatars.discourse-cdn.com/v4/letter/f/ccd318/32.png) [@Fred\_vom\_Jupiter](https://meta.discourse.org/u/Fred_vom_Jupiter)
#### Post date: [3월 21, 2016, 12:27오후 UTC](https://meta.discourse.org/t/when-in-a-category-default-to-none-rather-than-all-subcategories/26173/6 "2016-03-21T12:27:19Z")

</div>

For me the first part for the category list did not work. so here is my solution.

> ```
> $(document).ready(function() {
> // do it only once
> $('td.category .ember-view a').each(function() {
> if ($(this).hasClass('link-fixed')) {
> return;
> }
> // do it only if there's subcategories
> if ($(this).parents('td.category').find('div.subcategories').length) {
> var link = $(this).prop('href');
> $(this).prop('href', link+'/none');
> }
>             
> $(this).addClass('link-fixed');
> });
>         
> });
> 
> ```

---

<div class="post-metadata">

### Author: ![Cataldo\_Cigliola](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cataldo_cigliola/32/120763_2.png) [@Cataldo\_Cigliola](https://meta.discourse.org/u/Cataldo_Cigliola)
#### Post date: [8월 13, 2017, 11:41오후 UTC](https://meta.discourse.org/t/when-in-a-category-default-to-none-rather-than-all-subcategories/26173/7 "2017-08-13T23:41:41Z")

</div>

Hi

I am having some issues with this… I added the js to my head section but apparently it breaks if you click on the logo to get back to the home page.

Step to reproduce:

- go to the discourse website
- select a category with subcategories → it works, defaults to “none”
- click on the discourse logo (upper left) and go back to the home
- select a category with subcategories → it doesn’t works, defaults to “all”

Any idea why ?

---

<div class="post-metadata">

### Author: ![artur-shaik](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/artur-shaik/32/99836_2.png) [@artur-shaik](https://meta.discourse.org/u/artur-shaik)
#### Post date: [5월 23, 2018, 6:46오후 UTC](https://meta.discourse.org/t/when-in-a-category-default-to-none-rather-than-all-subcategories/26173/8 "2018-05-23T18:46:52Z")

</div>

Is it so hard to make second’s dropdown list value configurable?

---

<div class="post-metadata">

### Author: ![JPick](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jpick/32/100046_2.png) [@JPick](https://meta.discourse.org/u/JPick)
#### Post date: [6월 28, 2018, 10:57오전 UTC](https://meta.discourse.org/t/when-in-a-category-default-to-none-rather-than-all-subcategories/26173/9 "2018-06-28T10:57:03Z")

</div>

I’d love to see this as a built-in feature too.

We’re using subcategories for discussions in different languages (one for English, one for Spanish etc.) so seeing a list of discussions in different languages on the parent category page is a bit confusing for people.

It would be really useful to be able to have ‘None’ as the default view for the category page (as in screenshot below) instead of ‘all in [category name]’

![None](https://global.discourse-cdn.com/meta/optimized/3X/3/f/3fe119dbe4a1f30bf319860beeac1c1bb71abdc8_2_690x57.png)

Are there plans to implement this?

---

<div class="post-metadata">

### Author: ![artur-shaik](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/artur-shaik/32/99836_2.png) [@artur-shaik](https://meta.discourse.org/u/artur-shaik)
#### Post date: [2월 24, 2019, 3:10오후 UTC](https://meta.discourse.org/t/when-in-a-category-default-to-none-rather-than-all-subcategories/26173/10 "2019-02-24T15:10:13Z")

</div>

I just had to modify some code.

> <https://github.com/discourse/discourse/blob/2d031a1beb206416f39601df224d192cf0907736/lib/topic_query.rb#L631>

Just make this line execute uncoditionally.

---

<div class="post-metadata">

### Author: ![JPick](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jpick/32/100046_2.png) [@JPick](https://meta.discourse.org/u/JPick)
#### Post date: [5월 27, 2019, 8:47오전 UTC](https://meta.discourse.org/t/when-in-a-category-default-to-none-rather-than-all-subcategories/26173/11 "2019-05-27T08:47:45Z")

</div>

Thanks Artur, glad you found a simple solution!

We’re on a hosted instance of Discourse, so unfortunately don’t have access to the source code. We’ll keep using the Javascript workarounds from above; they’re great, but we haven’t found a way to solve the [issue described by Cataldo](https://meta.discourse.org/t/when-in-a-category-default-to-none-rather-than-all-subcategories/26173/7).

---

<div class="post-metadata">

### Author: ![Negativ72rus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/negativ72rus/32/134093_2.png) [@Negativ72rus](https://meta.discourse.org/u/Negativ72rus)
#### Post date: [7월 23, 2019, 10:14오전 UTC](https://meta.discourse.org/t/when-in-a-category-default-to-none-rather-than-all-subcategories/26173/12 "2019-07-23T10:14:24Z")

</div>

Unfortunately, the proposed solution does not work for us. ☹ We are waiting for the built-in function.

 ![image](https://global.discourse-cdn.com/meta/original/3X/9/1/91eff1bc23e30aa8438e968e568aa430279b4a54.png)  
Is this not possible with the option link to the section? Unfortunately I did not succeed.

---

<div class="post-metadata">

### Author: ![gazreyn](https://avatars.discourse-cdn.com/v4/letter/g/96bed5/32.png) [@gazreyn](https://meta.discourse.org/u/gazreyn)
#### Post date: [12월 9, 2019, 8:00오전 UTC](https://meta.discourse.org/t/when-in-a-category-default-to-none-rather-than-all-subcategories/26173/13 "2019-12-09T08:00:21Z")

</div>

네, 이 기능이 내장 옵션으로 제공되면 좋겠어요. 그렇게 하면 과거의 포럼처럼 더 잘 작동할 거예요.

---

<div class="post-metadata">

### Author: ![brechtm](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/brechtm/32/168517_2.png) [@brechtm](https://meta.discourse.org/u/brechtm)
#### Post date: [2월 4, 2020, 10:05오후 UTC](https://meta.discourse.org/t/when-in-a-category-default-to-none-rather-than-all-subcategories/26173/14 "2020-02-04T22:05:30Z")

</div>

여전히 검토 중인지, 아니면 아예 보류된 건지 확인차 여쭤봅니다…

---

<div class="post-metadata">

### Author: ![Mephie](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Mephie](https://meta.discourse.org/u/Mephie)
#### Post date: [2월 5, 2020, 9:47오전 UTC](https://meta.discourse.org/t/when-in-a-category-default-to-none-rather-than-all-subcategories/26173/15 "2020-02-05T09:47:41Z")

</div>

이 문제에 대한 업데이트가 있으면 좋겠습니다. 포럼에 익숙하지 않은 사용자(신규 사용자)들의 생활을 훨씬 편하게 만들어 줄 테니까요.

---

<div class="post-metadata">

### Author: ![Johani](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/johani/32/176920_2.png) [@Johani](https://meta.discourse.org/u/Johani)
#### Post date: [10월 7, 2021, 9:57오후 UTC](https://meta.discourse.org/t/when-in-a-category-default-to-none-rather-than-all-subcategories/26173/16 "2021-10-07T21:57:04Z")

</div>

카테고리별로 이 기능을 설정할 수 있습니다.

카테고리 페이지로 이동하세요. 예를 들어…

`https://meta.discourse.org/c/support/6`

그런 다음 여기서 렌치 아이콘을 클릭하세요.

![category edit button](https://cdck-file-uploads-global.s3.dualstack.us-west-2.amazonaws.com/meta/optimized/3X/b/2/b29e85cde94a80e8dc280150c86837ac06b261be_2_690x26.png)

그러면 해당 특정 카테고리의 설정 페이지로 이동합니다. 거기서 여기서 클릭하세요.

 ![category settings sections](https://global.discourse-cdn.com/meta/original/3X/a/4/a426291ab7762c6e34134aaa7cb313543b4e9a57.png)

그리고 아래로 조금 스크롤하여 이 설정을 찾을 때까지 이동하세요.

 ![image](https://global.discourse-cdn.com/meta/original/3X/6/9/694b39f1eda00b4e2b11a3cd6b9774a3bc7df208.png)

그 값을 다음과 같이 “no subcategories”(하위 카테고리 없음)로 변경하세요.

 ![image](https://global.discourse-cdn.com/meta/original/3X/3/d/3ddb7d5c9e835b8e13a2726909d778c49934f894.png)

그러면 해당 카테고리에 대해 원하는 결과가 나타납니다. 해당 카테고리의 주제 목록에는 상위 카테고리 내의 주제만 표시되고, 하위 카테고리 내의 주제는 무시됩니다.

다른 카테고리 페이지에서도 동일한 동작을 원한다면, 위에서 언급했듯이 해당 카테고리들에 대해 이 과정을 반복하세요. 이는 카테고리별 설정입니다.

---

<div class="post-metadata">

### Author: ![pHneutre](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/phneutre/32/326831_2.png) [@pHneutre](https://meta.discourse.org/u/pHneutre)
#### Post date: [3월 26, 2025, 6:36오후 UTC](https://meta.discourse.org/t/when-in-a-category-default-to-none-rather-than-all-subcategories/26173/17 "2025-03-26T18:36:28Z")

</div>

해결책 감사합니다. 설정과 무관하게 “전체” 보기나 “없음” 보기를 독립적으로 볼 수 있는 방법이 있을까요? 현재는 URL을 직접 수정해서 "/none"을 추가해야 하는데, 일반 사용자에게는 접근하기가 어렵습니다.

수정: 네, 방법이 있네요. 제 실수였습니다!

 ![image](https://global.discourse-cdn.com/meta/original/4X/3/8/f/38f68600024da3cadc053f192c6a8a0bce99dbb4.png)
