-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Category auto-generated index page should support custom category/link descriptions #7818
Comments
What I understand is that you want this to display in a better way That seems reasonable to add a sidebar link attribute to provide a link description
I doubt we'll want to implement this. Instead we should allow you to use top-level async/await in {
type: 'link',
href: 'https://facebook.com',
label: await fetchLabel(),
}, Unfortunately, this is blocked by sindresorhus/import-fresh#22 so this will come later. In the meantime, you can use sync FS calls if the data is available locally |
@slorber Hi, I want to work on this issue , but I am new to this project. |
Hey @heysujal, this is a very simple issue but it requires being used to Docusaurus in the first place to understand what should be done. If it's not the case, I'd recommend becoming first familiar with Docusaurus and only then trying to contribute. We have an active discord channel in case you are looking for help. |
@slorber @Dr-Electron @dreiss |
go ahead then |
Similarly, we want to support custom category descriptions See #7985 |
Would be nice to also support custom icons too, or add that as an option in the front matter of docs in general. |
It would be weird to allow you to provide a custom icon as frontmatter. Custom icons are not only emojis like we used there, but can also be svgs, images, react components... The best way to provide custom icons atm is with swizzling, and we'll make this easier |
Hi @slorber ! I wanted to ask you a few questions. As far as I'm understanding the thread it seems there were multiple requests, the one that seems not to be completed is this following one, isn't it?
If so, I would love to contribute to this issue 😊 |
@ZarakiKanzaki we need a description on:
Go ahead and open a PR then. As you can see people want to work on it but then go silent, so we don't claim issues anymore and just open the PR directly. Once the PR is open we can chat more about the details in it. |
Thank you for your quick reply 😊 I'll try to open a PR asap |
Hey can you assign this issue to me? |
@Jaya-sys FYI |
Something else to address likely in the same PR @ZarakiKanzaki: #7598 If a category has a link to a doc, and that category doesn't have a "description" attribute, we can use the linked doc's frontMatter.description as a fallback value |
@slorber would it also be possible to provide an image to the auto-generator from within the doc that is then displayed in the index box for each page in a fixed size? |
@pke any prod doc example or mockup to share? How such image should be provided, and displayed? Does something prevent you from implementing this with swizzle+customProps, and deploy to prod, so that we can learn from your live code + design? |
If you @slorber could point me to a doc about this swizzle+customProps pattern I would certainly give it a try. So the screenshot could be supplied via front-matter or be just the first image tag, that is encountered (much like the category text is extracted from the first paragraph) |
@pke each docs sidebar item allows passing arbitrary data as a This data is injected into the relevant sidebar item components as props too, so if you swizzle and theme component responsible for rendering a sidebar item, you can use that data here. The components that render sidebar items include:
I would suggest to assign If you are using auto-generated sidebars it should work to declare |
Basic support for category/link description through the sidebar file (not autogenerated) was added in #8236 and will be in Docusaurus v2.4 This issue remains open to add support for other cases. Note: I think we should also allow description on doc/ref items? Also it looks like it's not possible to override docs |
Hey i am new to opensource and want to contribute to this what actually want to change in this. You want to remove that 4items with custom texts right? |
Hey, i would like to take up this issue. |
If anyone want to contribute, the remaining part is to add a Currently, this doesn't work and we get an error We don't claim issues here. The first to submit a decent draft PR will more likely to be merged. |
Hey @slorber I have fixed this issue |
Have you read the Contributing Guidelines on issues?
Description
If you use index pages and your sidebar contains a link it would be nice if you could either:
{
type: 'link',
label: 'Facebook', // The link label
href: 'https://facebook.com', // The external URL
description: 'Some description'
},
or
Wdyt?
Has this been requested on Canny?
No. I can't login there because of some unknown error
Motivation
We would like to work more with index pages but we use a lot of links in the sidebar and that just don't really look nice.
API design
No response
Have you tried building it?
I didn't try to build it myself. Not sure what the best way would be yet. So maybe let's discuss first what would be possible.
Self-service
The text was updated successfully, but these errors were encountered: