Skip to content

DocCards showing a category which has an associated doc should show that doc's description (used in generated-index) #7598

Open

Description

@andrewnicols

Have you read the Contributing Guidelines on issues?

Prerequisites

Description

When showing a generated-index, or manually showing the DocCardList, a DocCard representing a Category where that category has an associated link or _category_.* should use the description associated with either of those items rather than just listing the number of items within it.

Reproducible demo

https://docusaurus.io/docs/category/guides

Steps to reproduce

  1. See https://docusaurus.io/docs/category/guides
  2. Note that the "Docs" category has four immediate children, but no description
  3. View the Docs category
  • Note: This is a document, with a usable description which would be more useful in the DocCard

Expected behavior

A useful description is shown

Actual behavior

The number of child documents is shown

Your environment

N/A

Self-service

  • I'd be willing to fix this bug myself.

Activity

  1. added
    bug
    status: needs triage
    on Jun 11, 2022
  2. removed
    status: needs triage
    on Jun 11, 2022
  3. slorber commented on Jun 16, 2022

    @slorber
    Collaborator

    @andrewnicols what I understand:

    We have a page "Docs Introduction": https://docusaurus.io/docs/docs-introduction

    It has a description (here inferred from content, but it does not matter): "The docs feature provides users with a way to organize Markdown files in a hierarchical format."

    This page is used as a sidebar category link.
    And the parent category has a generated index.

    CleanShot 2022-06-16 at 19 07 04@2x

    So you want the description to display there instead of the number of items?

    CleanShot 2022-06-16 at 19 07 51@2x


    That looks like a reasonable thing to do.

    Should this be configurable?

    Docs description is inferred so normally very often present, do we still need to display a count in some cases (as a fallback?)

    Do we always want to show the description (and not the doc title? which may be the same as the category name 🤷‍♂️ )

  4. sam-bryant commented on Oct 21, 2022

    @sam-bryant

    I'm encountering this issue as well. I don't want to comment as to the amount of configurability that's built. I'm essentially after the description.

    I've also noticed that the card text has a length of one line. It gets truncated with ... It might be nice to allow for a few lines of text for a card. Maybe that could be configurable.

    And while I'm at it, to be honest, it would be pretty sweet to be able to assign a custom icon. That being said, I would consider it a much lower priority.

  5. slorber commented on Oct 26, 2022

    @slorber
    Collaborator

    Related to #7818 where we allow a category to have a description. Will make sure that if the category links to a doc, we'll fallback to that doc description.

    Pending PR likely to implement this: #8236


    @sam-bryant regarding the card design, that's a different subject for which we'd rather have a dedicated feature request. Note you can swizzle the DocCard component to add the line length you want and custom icons.

    There's no way we'll provide good-enough config options that would fit the subjective tastes of all users, and swizzling will remain the solution that we encourage you to adopt for such use-cases.

  6. rayterion commented on Jan 8, 2026

    @rayterion

    Hi, this issue has been sitting around for a while, so I decided to investigate it.

    I think there’s no need to remove the default item counter, because you can set a custom description for each DocCard.

    The initial suggestion was to set the generated description to one of the linked document’s descriptions, but that wouldn’t be a very accurate description of the whole DocCard.

    In the sidebars.ts file, you can set a custom description for the generated DocCard as follows:

    Image

    And the result is:

    Image

    So maybe this issue should be closed?
    I’m open to any suggestions if not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions