Discourse Docs カードフィルター

:discourse2: Summary Discourse Docs Card Filter is to be used with the Discourse Docs Plugin and allows you to place “Cards” that act as a clickable filter for quicker filter results upon entering the /docs page by your users.
:eyeglasses: Preview Preview on Discourse Theme Creator
:hammer_and_wrench: Repository Link https://github.com/discourse/discourse-docs-card-filter
:open_book: New to Discourse Themes? Beginner’s guide to using Discourse Themes

Install this theme component

Features

The above would be rendered with these settings in the docs plugin:

Settings

You can select custom icons for each category or tag card filter. You can also allow category descriptions to be rendered in the category card filters.

Name Description
category icons Choose icons & topics order for corresponding category IDs. ex. ‘6,heart,title-asc’ would assign the heart icon to category 6 & will order topic list by ascending activity. NOTE: order can be (title,activity)-(asc/desc)
category description Enable the category description to be displayed in the category card filters for the docs page.
tag icons Choose icons & topics order for corresponding tag slugs. ex. ‘featured,heart,activity-desc’ would assign the heart icon to featured tag & will order topic list by ascending activity. NOTE: order can be (title,activity)-(asc/desc)
Translation Default
topics Topics
topic Topic

:discourse2: Hosted by us? Theme components are available to use on our Standard, Business, and Enterprise plans.

Last edited by @JammyDodger 2024-06-12T08:47:57Z

Check documentPerform check on document:
「いいね!」 33

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.

カードの並べ替え順序を変更する方法はありますか。コードの変更が必要な場合でも構いません。トピック数ではなく、アルファベット順にしたいです。よろしくお願いします!

「いいね!」 1

皆さん、こんにちは。ドキュメントとこのドキュメントの拡張機能は素晴らしいです。ただ一つだけ。これらのカードを top_menu または homepage セクションに追加する方法について、どなたかお手伝いいただけますか?デフォルトで「最新」が表示される標準のホームページがあり、これらのカードが一番上に表示されると素晴らしいでしょう。その後、カードをクリックするとフィルタリングされたドキュメントページに移動します。

また、top_menu セクションには別のプラグイン(検索ボックス)があります。このセクションに複数のプラグインが表示されている場合、順序を変更する方法がわかりませんでした。

よろしくお願いします。

「いいね!」 3

@jordan.vidrine様

tcを試したところ、ユースケースにうまく適合しました。これでKBを作成できます。

この件に関して質問があります。各カテゴリまたはタグカードにパラメータを追加する回避策はありますか?これにより、各個別のカテゴリまたはタグカードの並べ替えに影響を与えるために&order=titleを追加したいと考えています。

追伸:

うーん、よくわかりません。

カテゴリカードとタグカードの並び順をどのように表示したいですか?

ジョーダンさん

「カテゴリアイコン」のテーマ設定に並べ替えパラメータを追加できます。たとえば、「6,heart」の場合、並べ替えコマンドを追加できます。たとえば、トピックタイトルを昇順で並べ替える場合は、「6,heart,title-asc」となります。

カテゴリカードを開くと、次のようにドキュメントパラメータが追加されます。/docs?ascending=true&category=71&order=title

どう思われますか?

「いいね!」 1

サイトではうまく機能する可能性がありますが、カードの並べ替え機能に焦点を当てたこのトピックに関するフィードバックが少ないため、この機能を適切に機能させるために費やされた時間は現在正当化されているとは思いません。

とはいえ、コンポーネントのプルリクエスト(PR)や、コンポーネントを独自の目的でフォークすることを奨励しています。

この機能のプルリクエスト(PR)を作成するか、ご自身で開発するためにフォークしてください。

「いいね!」 3

@jrgong が作業をスポンサーしてくれるので、このリクエストに対してPRを作成できます。

「いいね!」 4

これを再度上げます!誰か解決策を見つけましたか?

「いいね!」 2

私の解決策は、カードをオフにすることでした(あまりにも多くのカテゴリがあり、役に立たないため)そして、ドキュメントの並べ替え順序を変更することでした。詳細については、こちらをご覧ください。Modifying Discourse Docs to only allow for sorting by Title - #2 by Nick_Chomey

「いいね!」 2

コンポーネントへの有益なプルリクエスト(PR)は、大歓迎です!

これらのカードをソートする機能を追加する場合、カテゴリIDとタグIDのカードの順序を指定できる新しい値リストを作成することをお勧めします。関連性のない既存の値リストにそれらを追加することはありません。

:smile:

「いいね!」 1

@jordan.vidrine 素晴らしいコンポーネントをデザインしていただきありがとうございます。モバイルデバイスでコンポーネントを無効にし、PC/Macで表示できるようにするには、何か方法はありますか?

なるほど。しかし、少なくとも category icons の設定を value-list に変更していただけませんか?単一のテキストフィールドよりも、複数のテキストフィールドでカードを管理する方がはるかに簡単です。 :wink:

そして、一時的な回避策として、各ドキュメントカードにそれぞれのカテゴリまたはタグのスラッグを持つ CSS クラスがあれば、非常に役立ちます。

変更前: \u003ca class=\"docs-card-box category-card\"\u003e
変更後: \u003ca class=\"docs-card-box [category-slug] category-card\"\u003e

「いいね!」 1

これは良い提案です :+1:

「いいね!」 2

テストでお手伝いが必要な場合はお知らせください。喜んで実験台になります :slight_smile:

「いいね!」 1

さらに検討した結果、category icons の設定を値リストに変更しないことにしました。フォールバックオプションがないと、現在のユーザーのコンポーネントが破損する可能性があるためです。

フォールバックを追加するには、ユーザーが現在のフィールドにアイコンを設定しているか、または新しい value-list フィールドに設定しているかを確認する必要があります。これはこのコンポーネントに追加するには煩雑すぎると感じており、設定レベルがさらに増え、混乱を招く可能性があります。

クラスの追加については、素晴らしいアイデアですが、より優先度の高い事項があるため、いつ追加できるかのタイムラインはありません。

とはいえ、可能な限り、当社のコンポーネントへのプルリクエストも歓迎します。私たちは結局のところオープンソースなのですから!

「いいね!」 1