Discourse 문서 카드 필터

:discourse2: 요약 Discourse Docs Card FilterDiscourse Docs 플러그인과 함께 사용되며, 사용자가 /docs 페이지에 진입할 때 더 빠른 필터 결과를 얻기 위해 클릭 가능한 필터 역할을 하는 "카드"를 배치할 수 있도록 합니다.
:eyeglasses: 미리보기 Discourse Theme Creator에서 미리보기
:hammer_and_wrench: 리포지토리 링크 https://github.com/discourse/discourse-docs-card-filter
:open_book: Discourse 테마 초보자? Discourse 테마 사용 입문 가이드

이 테마 컴포넌트 설치

기능

위 내용은 docs 플러그인에서 다음 설정으로 렌더링됩니다:

설정

카테고리 또는 태그 카드 필터마다 사용자 정의 아이콘을 선택할 수 있습니다. 또한 카테고리 카드 필터에 카테고리 설명이 렌더링되도록 허용할 수도 있습니다.

이름 설명
카테고리 아이콘 해당 카테고리 ID에 대한 아이콘 및 주제 순서를 선택합니다. 예: '6,heart,title-asc’는 카테고리 6에 하트 아이콘을 할당하고 주제 목록을 활동 순으로 정렬합니다. 참고: 순서는 (title,activity)-(asc/desc)일 수 있습니다.
카테고리 설명 docs 페이지의 카테고리 카드 필터에 카테고리 설명이 표시되도록 활성화합니다.
태그 아이콘 해당 태그 슬러그에 대한 아이콘 및 주제 순서를 선택합니다. 예: 'featured,heart,activity-desc’는 featured 태그에 하트 아이콘을 할당하고 주제 목록을 활동 순으로 정렬합니다. 참고: 순서는 (title,activity)-(asc/desc)일 수 있습니다.
번역 기본값
topics 주제들
topic 주제

:discourse2: 우리가 호스팅을 하고 있나요? 테마 컴포넌트는 Standard, Business, Enterprise 플랜에서 사용 가능합니다.

35개의 좋아요

Thanks for building this! Is it the case that if a user doesn’t have view permissions on a (private) category, the card for that private category won’t appear above the search box? (Or I suppose on the sidebar, but just want to confirm the behavior is consistent.)

1개의 좋아요

This should be the case as we are getting the category info from

@discourseComputed("category")
  categoryInfo(category) {
    return this.site.categories.findBy("id", category.id);
  },

To my knowledge, this.site.categories will only return those the current user can view.

2개의 좋아요

Excellent. That will make it a real easy-to-use tool for people in our multiple workgroups who want quick access to their group(s) reference materials, and quickly filter our Group A from Group B, etc. Thanks!

3개의 좋아요

Is it possible that the counter on /docs does not count topics moved into that category after it is already created?

I just made a new category, added in docs, moved a few topics but the counter still says “0 topic”.

EDIT: seems it just takes a while to update.

Is there a way to change the sort order for the cards, even if it requires modifying the code? I’d like for it to be Alphabetical rather than by topic count. Thanks!

1개의 좋아요

Hi all. Docs and this extenstion of Docs are fantastic. Just one thing though. Can anyone assist me with somehow adding these cards to the top_menu or homepage sections? Would be awesome to have a standard homepage with ‘Latest’ by default, yet having these cards at the top. Then clicking on a card with take it to the filtered Docs page.

Also, I have another plugin (Search box) sitting in the top_menu section. I havent been able to figure out how to change order if multiple plugins are showing in this section.

Thanks.

3개의 좋아요

Hey @jordan.vidrine

We tried the tc and it works great for your use case. Now we can create a KB

In this context, I have a question: Can you suggest any workaround to add some parameters to each category or tag card? That way we would like to append &order=title in order to affect the sorting for each individual category or tag card.

PS:

Hmmm.. Im not sure.

How would you like the sorting of the category & tag cards to appear?

Hey Jordan

We could add a sorting parameter in category icons theme setting. For the example, in case of the 6,heart, we can add an additional sorting command, e.g. to sort by topic title ascending, it would be 6,heart,title-asc.

When opening the category card, it would then just append the docs parameters such as: /docs?ascending=true&category=71&order=title

What do you think about that?

1개의 좋아요

While it’s possible this could work well on a site, without much feedback around this topic focusing on the ability to sort the cards, I dont necessarily feel the time spent on getting this to work properly is currently warranted.

That being said, we do encourage PRs on components, as well as forking a component to use in your own way!

Please feel free to make a PR with this functionality, or fork it to develop for yourself.

3개의 좋아요

I can make a PR for this request as @jrgong is sponsoring the work.

4개의 좋아요

Bumping this one! Has anyone been able to figure it out?

2개의 좋아요

My solution was to turn off the cards (since I have too many categories to make them useful anyway) and modify the sort order of Docs. You can see more about that here Modifying Discourse Docs to only allow for sorting by Title - #2 by Nick_Chomey

2개의 좋아요

We definitely welcome beneficial PRs to our components!

If you were to add the ability to sort these cards, I would suggest creating a new value-list where you can put in the order of the cards by category ID and tag ID. I would not add them to an already existing value list for something unrelated.

:smile:

1개의 좋아요

@jordan.vidrine Thank you for designing the great component. Is there anyway to disable the compnent on mobile device but show on PC/Mac ?

Fair enough. But could you at least change the category icons setting to value-list? It’s much easier to manage the cards in multiple text fields rather than a single one. :wink:

And as temporary workaround, it would be super helpful if each docs card had a CSS class with the respective category or tag slug.

Before: <a class="docs-card-box category-card">
After: <a class="docs-card-box [category-slug] category-card">

1개의 좋아요

This is a good suggestion :+1:

2개의 좋아요

Let me know if you need help with testing, will be happy to be the lab rat :slight_smile:

1개의 좋아요

After thinking over it more, I have decided against changing the category icons setting to a value list as without a fallback option, would cause current users components to break.

Adding a fallback would look like checking to see if either the users has set the icons in the current field, or the new value-list field and I feel that is just too cumbersome to add onto this component, as it would add another level of settings and cause possible confusion.

As for the class additions, its a great idea, but I do not have a timeline for when this will be added as there are more pertinent things needing my attention.

That being said, when possible we also welcome PRs to our components, we are open source after all!

1개의 좋아요