facebook / facebook/docusaurus

Add breadcrumb for blog posts

Đang mở
#8,635 11 bình luận 0 reaction 0 người được giao Xem trên GitHub
feature
Ngôn ngữ chính
TypeScript
Star
66.2k
Fork
10k
Merge trung bình
1 ngày 3 giờ
Pull request đã merge (30 ngày)
52

Mô tả

### Have you read the Contributing Guidelines on issues?

- [X] I have read the [Contributing Guidelines on issues](https://github.com/facebook/docusaurus/blob/main/CONTRIBUTING.md#issues).

### Description

Add 2 breadcrumbs to blogs functionality; so blogs would have breadcrumbs in the same way docs have breadcrumbs:

- Blog archive page
- [BLOG ROOT URL] -> Archive
- Any blog post page
- [BLOG ROOT URL] -> Archive -> [BLOG POST]

### Has this been requested on Canny?

Yes: https://docusaurus.io/feature-requests/p/add-breadcrumb-for-blog-posts

### Motivation

I've been on a bit of a mission to improve my Docusaurus blogs SEO. The agency I'm working with suggested adding breadcrumb Structured Data. I've done that implement an invisible breadcrumb using JSON-LD here:

https://johnnyreilly.com/docusaurus-blogs-adding-breadcrumb-structured-data

I'm happy with what I've done, but I'm wondering if it might make sense for Docusaurus to have a breadcrumb in place for blog posts by default. Given that docs already have a breadcrumb (and one that surfaces Structured Data), I'm wondering if it might be useful if blog to as well?

If the answer if "yes", the follow on question becomes: what breadcrumb makes sense? In my head, this makes sense (and it's what I've implemented for my blog):

[BLOG ROOT URL] -> Archive -> [BLOG POST]

### API design

I'm unsure what level of configuration would make sense here. Perhaps as simple as having a `breadcrumbEnabled: boolean` option that defaults to `true` to allow people to opt out.

It seems likely that we could reuse the existing breadcrumb mechanism (I've had a quick look at the code and it seemed potentially shareable.)

What do you think?

### Have you tried building it?

No

### Self-service

- [X] I'd be willing to contribute this feature to Docusaurus myself.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.