Skip to content
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

Blog: add more useful content to the sidebar (tags, authors, feeds, links...) #5461

Open
Josh-Cena opened this issue Sep 1, 2021 · 6 comments
Labels
apprentice Issues that are good candidates to be handled by a Docusaurus apprentice / trainee difficulty: intermediate Issues that are medium difficulty level, e.g. moderate refactoring with a clear test plan. feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future. status: accepting pr This issue has been accepted, and we are looking for community contributors to implement this
Milestone

Comments

@Josh-Cena
Copy link
Collaborator

Josh-Cena commented Sep 1, 2021

🚀 Feature

Make the feeds, tags page, archive page, authors page (if the last ever gets implemented) directly visitable from the index page.

Have you read the Contributing Guidelines on issues?

Yes

Has this been requested on Canny?

No

Motivation

  • Currently, to visit the tags page, the user has to click on a tag, then click "view all tags"—that's two layers of Indirection.
  • For the feeds, afaik there's currently no way to access them (besides typing in the URL, of course, given that you know where the file lives), or any indication that they even exist.
  • From the current status of feat: adds blog archive route #5428 (I understand it's still underdeveloped), it's unlikely that a link will be provided on the index page.

I propose we have a "links group" on the blog index page providing access to all these pages.

API Design

The only place where these links can be tucked in is probably the blog sidebar. The links group can be added below the sidebar title or below the list of post titles. We can even add little icons like "feeds" and "tag" :)

Not sure if it's worth providing options to toggle these links on or off; I guess keeping them won't distort the appearance of the page much anyways

Have you tried building it?

Because I have a swizzled blog page, I directly added the links group below the blog title: https://joshcena.com/blog/

This is actually pretty easy to achieve in the userland (just wrap the existing BlogSidebar, doesn't even require swizzling), but from a design perspective I find it inadequate for this to be missing from the theme itself.

Edit. I was a bit naïve when I believed we could wrap the sidebar. Turns out that the sidebar has fixed position, but the wrapped one doesn't, so for this code:

export default function BlogSidebar(props) {
  return (
    <>
      <OriginalBlogSidebar {...props} />
      <div>Links</div>
    </>
  );
}

The "Links" text just scrolls up when the page is scrolled while the sidebar is fixed. Therefore the user still has to swizzle the Sidebar component, which is undesirable.

@Josh-Cena Josh-Cena added feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future. status: needs triage This issue has not been triaged by maintainers labels Sep 1, 2021
@slorber
Copy link
Collaborator

slorber commented Sep 1, 2021

Agree that we should do something to make the blog sidebar easier to customize.

I'm thinking we could have blog sidebar items, similar to navbar items (and we should also provide a way to create custom blog sidebar items).

This would require that we create a "sidebar module" with more data in it (that all blog pages would receive) so that the theme sidebar items can use those data.

We could create predefined sidebar items for recent posts, tags, sections with list of links etc... but in the end the user can create its own items to handle specific use-cases.


@sw-yx has a customized sidebar here, as a good example of what is wanted in userland

https://docs.temporal.io/blog

image

Currently, require swizzling + hardcoded data:

https://github.com/temporalio/documentation/blob/master/src/theme/BlogSidebar/index.js

@slorber slorber changed the title Blog: make certain pages directly accessible Blog: add more useful content to the sidebar (tags, authors, feeds, links...) Sep 2, 2021
@bzp2010
Copy link

bzp2010 commented Sep 17, 2021

Hi, floks. Any update here?

Whether the data [1] in the blog plugin can be opened through GlobalData? I noticed that the data[2] in the docs plugin was added to GlobalData.

Just like this data:

image
[1] content data from blog plugin

image
[2] global data of docs plugin

@Josh-Cena
Copy link
Collaborator Author

@bzp2010 Unfortunately no. We tend to be restricted in using global data because it increases the entire site's load time. Is there a particular reason to add blog data to Global Data? You can enhance the blog plugin to add global data if you need to

@slorber
Copy link
Collaborator

slorber commented Sep 21, 2021

We should avoid putting too much data into the global data layer as it increases the site site globally.

In case you want to consume blog data on non-blog pages (like your homepage) I'd like to introduce something new later, allowing individual pages to declare their data requirements. A bit like Gatsby/Next.js already do, but something simpler. But this is not really related to the current issue, and will not be worked on very soon.

@bzp2010
Copy link

bzp2010 commented Sep 21, 2021

Yes, putting all the data into GlobalData is just an expedient measure. I look forward to the new content you will introduce.

@Josh-Cena Josh-Cena removed the status: needs triage This issue has not been triaged by maintainers label Oct 30, 2021
@Josh-Cena Josh-Cena added difficulty: intermediate Issues that are medium difficulty level, e.g. moderate refactoring with a clear test plan. status: accepting pr This issue has been accepted, and we are looking for community contributors to implement this labels Dec 15, 2021
@Josh-Cena Josh-Cena added this to the 2.x milestone Feb 18, 2022
@xuanswe
Copy link

xuanswe commented Mar 25, 2023

Really love to have a similar power of sidebar configuration as we have for docs plugin.

@slorber slorber modified the milestones: 2.x, Upcoming Aug 17, 2023
@slorber slorber added the apprentice Issues that are good candidates to be handled by a Docusaurus apprentice / trainee label Sep 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
apprentice Issues that are good candidates to be handled by a Docusaurus apprentice / trainee difficulty: intermediate Issues that are medium difficulty level, e.g. moderate refactoring with a clear test plan. feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future. status: accepting pr This issue has been accepted, and we are looking for community contributors to implement this
Projects
None yet
Development

No branches or pull requests

4 participants