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

Use doc front matter to customize pagination #5688

Closed
Josh-Cena opened this issue Oct 12, 2021 · 5 comments · Fixed by #5705
Closed

Use doc front matter to customize pagination #5688

Josh-Cena opened this issue Oct 12, 2021 · 5 comments · Fixed by #5705
Labels
feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future.

Comments

@Josh-Cena
Copy link
Collaborator

Josh-Cena commented Oct 12, 2021

🚀 Feature

An option to hide specific pagination buttons, and repoint pagination links to other doc pages.

Have you read the Contributing Guidelines on issues?

Yes

Has this been requested on Canny?

https://docusaurus.io/feature-requests/p/allow-for-non-linear-navigation kind of points to this

Motivation

To allow for non-linear navigation; also related to #5686 because this will be used home pages where navigation doesn't make sense

API Design

  • pagination_next: my-doc (a doc ID)
  • pagination_prev: my-doc
  • pagination_next: null (disable pagination)
  • pagination_prev: null

Have you tried building it?

Yes, using swizzling and adding CSS to hide pagination; but repointing links would require editing on the plugin side

@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 Oct 12, 2021
@slorber
Copy link
Collaborator

slorber commented Oct 12, 2021

It shouldn't be hard to add.

I'm not 100% sure to understand the use-case though.

If a doc is already in the sidebar then there's linear navigation in the sidebar already, so why only disable this linear navigation at the bottom of the doc but not in the sidebar?

If the doc shouldn't have any linear navigation then hiding both the sidebar + the bottom nav may make sense, in which case the user can use a sidebar doc ref instead?

@Josh-Cena
Copy link
Collaborator Author

If a doc is already in the sidebar then there's linear navigation in the sidebar already, so why only disable this linear navigation at the bottom of the doc but not in the sidebar?

The sidebar is not linear; the sidebar is a tree structure.

For example, in that Canny request, the OP is doing something like "category: installation; items: Windows, Mac, Linux". In this case, after browsing "Installation > Windows", the user should be taken directly to the next step (e.g. configuration), not "Installation > Mac".

If the doc shouldn't have any linear navigation then hiding both the sidebar + the bottom nav may make sense, in which case the user can use a sidebar doc ref instead?

In fact, as I described in #5686, the "home page doc" should have the sidebar but without pagination, hope that makes sense

@slorber
Copy link
Collaborator

slorber commented Oct 13, 2021

For example, in that Canny request, the OP is doing something like "category: installation; items: Windows, Mac, Linux". In this case, after browsing "Installation > Windows", the user should be taken directly to the next step (e.g. configuration), not "Installation > Mac".

Makes sense, agree we should add this.

Does it make sense to also allow arbitrary links for next/previous?
For example, you could want the first doc previous button to link to your homepage, and your last doc next button to link to some other standalone page? (in this case frontmatter would need a link+label)

(I still think that we should handle a "docId" shortcut because it's likely the most common use-case, supporting an object syntax in yaml can be supported later anyway)

@Josh-Cena
Copy link
Collaborator Author

Does it make sense to also allow arbitrary links for next/previous?

I just propose we use doc IDs as next/previous :P Makes the implementation / validation so much easier. We can allow arbitrary links later maybe, but IMO it doesn't make much sense

@slorber
Copy link
Collaborator

slorber commented Oct 13, 2021

Agree, let's keep it simple for now, as long as we keep the ability to improve later without breaking changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants