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

Add Toc to blog posts #2717

Closed
donaldboulton opened this issue May 3, 2020 · 11 comments
Closed

Add Toc to blog posts #2717

donaldboulton opened this issue May 3, 2020 · 11 comments
Labels
mlh Major League Hacking Fellowship proposal This issue is a proposal, usually non-trivial change

Comments

@donaldboulton
Copy link

💥 Proposal

(A clear and concise description of what the proposal is.)

Docusarus v2 -54
How to add a Table Of Contents to Blog Posts like docs have.

Have you read the Contributing Guidelines on issues?

(Write your answer here.)

@donaldboulton donaldboulton added status: needs triage This issue has not been triaged by maintainers proposal This issue is a proposal, usually non-trivial change labels May 3, 2020
@yangshun
Copy link
Contributor

yangshun commented May 5, 2020

Swizzle the components.

@yangshun yangshun closed this as completed May 5, 2020
@skychx
Copy link

skychx commented Jul 11, 2020

Swizzle the components.

sorry, I don't understand the meaning of "Swizzle the components"。

I read the V2 documentation and it seems that only Docs has TOC, but V1's blog supports TOC

@skychx
Copy link

skychx commented Jul 11, 2020

Swizzle the components.
image

image

@skychx
Copy link

skychx commented Jul 12, 2020

Swizzle the components.
image

image

Finally, I use

yarn run swizzle @docusaurus/theme-classic

change src/theme/BlogPostPage/index.js add the Toc

@slorber
Copy link
Collaborator

slorber commented Jul 13, 2020

Yes @skychx you can swizzle the blog post page, it should have a property "rightToc" assigned to it, and you can reuse the Headings comp of the classic theme to render it.

Do you think we should provide this feature out of the box for blog posts too?

@skychx
Copy link

skychx commented Jul 14, 2020

Yes @skychx you can swizzle the blog post page, it should have a property "rightToc" assigned to it, and you can reuse the Headings comp of the classic theme to render it.

Do you think we should provide this feature out of the box for blog posts too?

YES! I think this is a very useful feature to clearly show the structure of the article.

@slorber slorber reopened this Jul 14, 2020
@slorber slorber added mlh Major League Hacking Fellowship v2 and removed status: needs triage This issue has not been triaged by maintainers labels Jul 14, 2020
@muhsatrio
Copy link

muhsatrio commented Jul 24, 2020

Swizzle the components.
image

image

may I shoot PR for adding the "Recent Post" section to v2 docusaurus? I think this feature is still needed, thank you @slorber

@slorber
Copy link
Collaborator

slorber commented Jul 24, 2020

Recent posts and TOC seems like useful things PR welcome 👌

@amy-lei
Copy link
Contributor

amy-lei commented Aug 10, 2020

I would love to work on the TOC feature! 😃

@slorber
Copy link
Collaborator

slorber commented Aug 11, 2020

yes @amy-lei thanks

@ghost
Copy link

ghost commented Nov 13, 2021

Is it possible to do this at this point (add a table of contents to a blog page, like is the default for docs pages)? I tried

yarn run swizzle @docusaurus/theme-classic

as suggested above, but I got loads of unsafe warnings, so I stopped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mlh Major League Hacking Fellowship proposal This issue is a proposal, usually non-trivial change
Projects
None yet
Development

No branches or pull requests

6 participants