Skip to content

feat(v2): allow home page for docs - #2652

Merged
yangshun merged 7 commits into
masterfrom
lex111/docs-route
May 17, 2020
Merged

yangshun merged 7 commits into
masterfrom
lex111/docs-route

Conversation

@lex111

@lex111 lex111 commented Apr 24, 2020 •

Copy link
Copy Markdown
Contributor

Motivation

I am really excited to close all three of the listed PRs, finally this issue, which our users constantly mention, will be closed! 😝

Resolve #2507
Resolve #2567
Resolve #1973

Related issue on Canny - https://docusaurus.canny.io/admin/board/feature-requests/p/home-page-for-docs

Yes, indeed, although there are not many changes, the complexity of the code increases, but this is all because to cover all use cases:

  • Docs without versioning
  • Docs with versioning
  • Docs-only mode
  • Using existing document as home page
  • Using special-purpose document (default is "_index") as home page
  • Possibility to have the own docs page (thereby override the default home page, this may be useful in versioning docs)

Have you read the Contributing Guidelines on pull requests?

Yes

Test Plan

See docs and preview (eg. https://deploy-preview-2652--docusaurus-2.netlify.app/docs/)

P.S. You can see in snapshots diff that the sorting of routes has been changed, that's actually how it should be (so you don't have to worry about that).

https://github.com/facebook/docusaurus/blob/1f00d15c7439fdbfb37d57f0cafdaedb2b34ef41/packages/docusaurus/src/server/plugins/index.ts#L103-L105

Related PRs

(If this PR adds or changes functionality, please take some time to update the docs at https://github.com/facebook/docusaurus, and link to your PR here.)

@lex111 lex111 added the pr: new feature This PR adds a new API or behavior. label Apr 24, 2020
@lex111
lex111 requested a review from yangshun April 24, 2020 17:03
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Apr 24, 2020
@lex111
lex111 force-pushed the lex111/docs-route branch from 92d16c7 to 87be59e Compare April 24, 2020 17:05
@docusaurus-bot

Copy link
Copy Markdown
Contributor

@lex111

lex111 commented Apr 24, 2020 •

Copy link
Copy Markdown
Contributor Author

It is strange why Travis CI fails, I have everything OK on my local machine.
@yangshun could please you force it to restart?

It's all right.

@meta meta deleted a comment from docusaurus-bot Apr 24, 2020
@lex111

lex111 commented Apr 25, 2020

Copy link
Copy Markdown
Contributor Author

Again, there seems to be a problem with snapshots being different in local (dev) and test (CI) environments. I take it this is due to the asynchronous processing of routes, perhaps it is worth sorting routes to achieve the same result?

@lex111

lex111 commented Apr 26, 2020

Copy link
Copy Markdown
Contributor Author

Even in my fork, tests with changes to this PR successfully pass. I can’t understand why in this (original) repo does not pass the tests.

Test Suites: 47 passed, 47 total
Tests:       267 passed, 267 total
Snapshots:   123 passed, 123 total
Time:        134.669s
Ran all test suites.
Done in 136.01s.

@lex111

lex111 commented Apr 26, 2020

Copy link
Copy Markdown
Contributor Author

Hell yeah, I added sorting for child routes and tests began to pass for CI. Now we have the same result on all environments.

@lex111 lex111 modified the milestone: v2.0.0-alpha.54 Apr 27, 2020
@lex111 lex111 mentioned this pull request May 5, 2020
@benmccann

Copy link
Copy Markdown
Contributor

Thanks for this! Just FYI, this PR will need a rebase

The other thing that will help us a lot with the homepage is #2537

@yangshun yangshun left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add this feature into the examples too?

@yangshun
yangshun merged commit 00a8e9e into master May 17, 2020
@yangshun
yangshun deleted the lex111/docs-route branch May 17, 2020 09:48
@lex111

lex111 commented May 17, 2020

Copy link
Copy Markdown
Contributor Author

Should we add this feature into the examples too?

Do you mean init template?

@yangshun

Copy link
Copy Markdown
Contributor

Oh yes the templates. I think we should add useful defaults to the templates.

mrizwanashiq pushed a commit to mrizwanashiq/docusaurus that referenced this pull request Jun 25, 2026
* feat(v2): allow home page for docs

* Refactor

* Remove debugging info 🤦‍♂️

* Add sort routes for first test case

* Sort child routes for consistency
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

Allow marking a documentation page as the landing page feat(v2): home page for docs [V2] Handle /docs route

5 participants