Skip to content

Autogenerated entries: allow image override per entry #7844

@ArthurFlag

Description

@ArthurFlag

Have you read the Contributing Guidelines on issues?

Description

In the current state, Docusaurus' autogenerated entries generates tiles looking like this:

Screenshot 2022-07-28 at 16 13 45

Auto-generating entries is a great feature, and in my case, I'd like to use it to get scalable docs, such as listing many partners that my company integrates with.

For this, I would suggest to add the ability to customize the image that we add to the tile. Currently it's either the file or folder icon.

For example, adding this to the sidebar to specify a new image:

  {
          type: 'category',
          label: 'Essentials',
          link: {
            type: 'generated-index',
            title: 'Essentials',
            image: 'somelogopath.png'  <------- new
            description: 'my description',
            slug: 'dev/tutorials/essentials',
          },
          items: [
            'some link',
}

Or when generating tiles from a doc page with:

<DocCardList items={useCurrentSidebarCategory().items}/>

We could perhaps define the image in each entry in the sidebar.js file as well, using longhand notation:

   {
              type: 'category',
              label: 'My page',
              link: {
                type: 'doc', 
                id: 'dev/...', <------- contains the DocCardList component
              },
              items: [
               {
                  type: 'doc',
                  id: 'myDoc',
                  image: 'somelogopath.png'  <------- new
                },
              ],
            }

Has this been requested on Canny?

No response

Motivation

I need this feature for scalability reasons so this feature will happen either on my own repo, but it should ideally be a core feature as it might help other users. I can possibly get a developer to submit a PR to your repo if you can share some pointers on how to do this 'the right way'.

API design

No response

Have you tried building it?

No response

Self-service

  • I'd be willing to contribute this feature to Docusaurus myself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    closed: wontfixA fix will bring significant overhead, or is out of scope (for feature requests)featureThis is not a bug or issue with Docusausus, per se. It is a feature request for the future.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions