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

feat(blog): group sidebar items by year (themeConfig.blog.sidebar.groupByYear) #10252

Merged
merged 12 commits into from
Jun 28, 2024

Conversation

alicelovescake
Copy link
Contributor

@alicelovescake alicelovescake commented Jun 27, 2024

Motivation

This PR adds a new themeConfig.blog.sidebar.groupByYear option to group sidebar items by year in both mobile/desktop views.

CleanShot 2024-06-28 at 14 34 57

CleanShot 2024-06-28 at 14 36 15

It is turned on by default to help feature discovery, because it makes sense for many sites to use it. Users that don't like it can opt-out with themeConfig.blog.sidebar.groupByYear = false

Test Plan

Unit tests + dogfood

Test links

https://deploy-preview-10252--docusaurus-2.netlify.app/blog

Docs: https://deploy-preview-10252--docusaurus-2.netlify.app/docs/api/themes/configuration/#blog

@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Jun 27, 2024
Copy link

netlify bot commented Jun 27, 2024

[V2]

Name Link
🔨 Latest commit 0da19fd
🔍 Latest deploy log https://app.netlify.com/sites/docusaurus-2/deploys/667eb0271bff760008d1279a
😎 Deploy Preview https://deploy-preview-10252--docusaurus-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

github-actions bot commented Jun 27, 2024

⚡️ Lighthouse report for the deploy preview of this PR

URL Performance Accessibility Best Practices SEO PWA Report
/ 🟠 89 🟢 98 🟢 96 🟢 100 🔴 NaN Report
/docs/installation 🟠 55 🟢 97 🟢 100 🟢 100 🔴 NaN Report
/docs/category/getting-started 🟠 75 🟢 100 🟢 100 🟠 86 🔴 NaN Report
/blog 🟠 70 🟢 100 🟢 100 🟠 86 🔴 NaN Report
/blog/preparing-your-site-for-docusaurus-v3 🔴 49 🟢 96 🟢 100 🟢 100 🔴 NaN Report
/blog/tags/release 🟠 70 🟢 100 🟢 100 🟠 86 🔴 NaN Report
/blog/tags 🟠 75 🟢 100 🟢 100 🟠 86 🔴 NaN Report

@slorber slorber added the pr: new feature This PR adds a new API or behavior. label Jun 27, 2024
@slorber
Copy link
Collaborator

slorber commented Jun 27, 2024

thanks @alicelovescake

Why not make it a first-class blog plugin option?
Otherwise, we expose data that we don't even use ourselves.
I think even for our own blog and others we'd want to turn this on.

I implemented a POC on your PR, let me know if this is what you had in mind:

CleanShot 2024-06-27 at 20 37 25@2x

@alicelovescake
Copy link
Contributor Author

thanks @alicelovescake

Why not make it a first-class blog plugin option? Otherwise, we expose data that we don't even use ourselves. I think even for our own blog and others we'd want to turn this on.

I implemented a POC on your PR, let me know if this is what you had in mind:

CleanShot 2024-06-27 at 20 37 25@2x

Love your code! It's exactly what we want and what I already implemented this on the Electron blog page. TBH, I wasn't sure whether you guys were open to the change so I just wanted to keep the PR as simple as possible.
How do you feel about adding a border at the bottom of the year header?

image

just added the css to mobile/desktop styles.module.css

.sidebarItemHeader {
  border-bottom: 0.01rem solid var(--ifm-table-border-color);
  padding-bottom: 4px;
}

Feel free to take over the PR with your changes and add a new config option. Let me know how I can help!

@slorber
Copy link
Collaborator

slorber commented Jun 28, 2024

Thanks for your feedback

Yes I'll take it over and refactor a few things in the process

How do you feel about adding a border at the bottom of the year header?

That's not super subtle IMHO, I'll try to find a good intermediate, but in any case you should be able to swizzle and customize for your own site if needed

@slorber slorber changed the title feat(blog): add date to sidebar item feat(blog): group sidebar items by year (themeConfig.blog.sidebar.groupByYear) Jun 28, 2024
@slorber slorber changed the title feat(blog): group sidebar items by year (themeConfig.blog.sidebar.groupByYear) feat(blog): group sidebar by year (themeConfig.blog.sidebar.groupByYear) Jun 28, 2024
@slorber slorber changed the title feat(blog): group sidebar by year (themeConfig.blog.sidebar.groupByYear) feat(blog): group sidebar items by year (themeConfig.blog.sidebar.groupByYear) Jun 28, 2024
@slorber slorber added the Argos Add this label to run UI visual regression tests. See argos.yml GH action. label Jun 28, 2024
@slorber
Copy link
Collaborator

slorber commented Jun 28, 2024

Ready to merge 🎉

Copy link

argos-ci bot commented Jun 28, 2024

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) ⚠️ Changes detected (Review) 46 changed, 1 removed Jun 28, 2024, 12:51 PM

@slorber slorber merged commit aab1f48 into facebook:main Jun 28, 2024
31 of 33 checks passed
@alicelovescake
Copy link
Contributor Author

Thanks @slorber for making this happen! You made this PR so much better. Excited for this change!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Argos Add this label to run UI visual regression tests. See argos.yml GH action. CLA Signed Signed Facebook CLA pr: new feature This PR adds a new API or behavior.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants