Docusaurus: Docusaurus for docs-only sites

Created on 17 Feb 2018  路  13Comments  路  Source: facebook/docusaurus

I've been looking for a system to publish our Markdown documents and Docusaurus looks really nice. However, it currently seems to be targeted on "project websites" where the base URL (docs.example.com) hosts a front page and the docs live in the /docs subfolder. There might be workaround like using only the /build/docs folder after build-time but it would be really great to see first-class support for docs-only sites as well.

Some things that I'd like to see in Docusaurus if it supported this use case:

  • New docusaurus-init mode that generates docs-only site.
  • Such site doesn't contain any frontpage or blog or anything else. The /docs folder is the root of the site and when I visit docs.example.com, I directly see the rendered /docs/index.md document.

    • (The docs are _not_ at docs.example.com/docs.)

  • There should be a React template for the docs pages, similarly to what exists today for custom pages.
  • There should be an on-page navigation (ToC) for longer documentation articles (some docs systems use the right sidebar, for example).
feature

Most helpful comment

@Happy-Ferret So the way we solved it for BlueWhale, which I don't think is a horrible solution, is to do a redirect from index.html to the first docs page.

https://github.com/facebookresearch/BlueWhale/blob/docs/website/static/index.html

All 13 comments

This seems like a similar request to: https://github.com/facebook/Docusaurus/issues/416

@ericnakagawa - you did this with your personal blog, didn't you?

Take this gist as index.js: https://gist.github.com/richardzcode/d0fcb3a98e60528340175aa5168835bb

It assumes you have a ../README.md file. If not then just modify the file path.

How would you render a markdown file + the docs sidebar, I can see DocsSidebar requires metadata, which i am not sure how to access

Just a heads-up, but BlueWhale seems to do what the OP asked for.

Although how, I have yet to investigate. Probably during the build step?

@Happy-Ferret So the way we solved it for BlueWhale, which I don't think is a horrible solution, is to do a redirect from index.html to the first docs page.

https://github.com/facebookresearch/BlueWhale/blob/docs/website/static/index.html

I support BlueWhale's solution.

I ended up doing this: No changes on the docusaurus project at all. But after yarn build, I move everything inside website/build/your-site/docs into website/build/your-site, then adjust the sidebar link. Everything is being done programatically.

Bluewhale solution doesn't work with Netlify.

EDIT: Nevermind, it does. You need to remove index.js.

Everyone still having this issue, its already documented here

The redirect solution still leaves you with a docs.example.com/docs URL instead of just docs.example.com. @novalagung can you elaborate on your solution, specially the sidebar link adjustment.

In v2 of this project it would be great to have suppport for docs-only or blog-only versions of the classic init config

Check Out Docs-only mode in the official Documentation of Docusaurus.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MoogyG picture MoogyG  路  3Comments

rickyvetter picture rickyvetter  路  3Comments

lex111 picture lex111  路  3Comments

JoelMarcey picture JoelMarcey  路  3Comments

endiliey picture endiliey  路  3Comments