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 a doc page as homepage #1253

Closed
o-t-w opened this issue Feb 27, 2019 · 13 comments
Closed

Use a doc page as homepage #1253

o-t-w opened this issue Feb 27, 2019 · 13 comments

Comments

@o-t-w
Copy link

o-t-w commented Feb 27, 2019

I do not require a landing page for my website. I would like the home page to be a page I have in the docs e.g. /docs/about/

My feature request (maybe it is already possible?) is to forego having the default homepage.

This way the use can get directly at what they came for - the documentation. My site won't offer much else, so it seems logical to go straight there. I wouldn't even know what to put on the homepage.

@JoelMarcey
Copy link
Contributor

This can be done. Other sites that use Docusaurus have done it. See:

https://docs.reactioncommerce.com/docs/intro.html

There are a couple of others on the users page - https://docusaurus.io/en/users

@JoelMarcey
Copy link
Contributor

See the documentation for this here: https://docusaurus.io/docs/en/site-creation#docs-landing-page

@amimas
Copy link

amimas commented Feb 28, 2019

See the documentation for this here: https://docusaurus.io/docs/en/site-creation#docs-landing-page

I've used that example in one of my doc site also. I think it would be useful if we could simply have a configuration for it. For example, if we set disableLandingPage: true in the configuration, docusaurus will automatically generate the site with a /index.html that redirects to /docs/index.html.

Thoughts?

@yangshun
Copy link
Contributor

@amimas We're prioritizing v2 work now and for v1 we will refrain from adding features and focus on doing bug fixes. I don't think this redirect is highly used so perhaps we should add it in v2 instead.

@yangshun yangshun added the v2 label Feb 28, 2019
@amimas
Copy link

amimas commented Mar 1, 2019

@yangshun completely agree. This isn't a priority for current version.

Btw, do you have any estimate on v2 release date? Not sure how much of the targetted features have been added to v2 already.

@yangshun
Copy link
Contributor

yangshun commented Mar 1, 2019

Btw, do you have any estimate on v2 release date?

Unfortunately it's not going as fast we would like it to be due to manpower constraints - one of our members is taking leave due to health, and I'm really swamped with my core work (Docusaurus is my side project). We hope to release a beta in the second half of the year. Follow the progress on the issue #789

Not sure how much of the targetted features have been added to v2 already.

I really should do better on providing visibility on the progress. We have a basic set of features live on https://munseo-preview.netlify.com/, but have yet to implement versioning and translations.

@endiliey endiliey closed this as completed Mar 5, 2019
@grenade
Copy link

grenade commented May 24, 2021

for anyone who experiences 404 errors using the index.html workaround described above, you can also modify src/pages/index.js to contain only a redirect instead of the landing page. eg:

import React from 'react';
import  { Redirect } from 'react-router-dom';

export default function Home() {
  return <Redirect to='/docs/intro' />;
}

@slorber
Copy link
Collaborator

slorber commented Aug 24, 2021

Note: the above trick is not really a good solution, as the redirect will be "slow" (requires loading/hydrating React).
A server redirect is always better than a heavy client-side redirect.

We have a "docs-only" to handle that specific usecase:
https://docusaurus.io/docs/docs-introduction#docs-only-mode

@sporritt
Copy link

Doesnt the docs only mode preclude the inclusion of other pages, though? Having a docs page as the landing page does not necessarily mean that you dont want pages such as the original index page, does it?

@slorber
Copy link
Collaborator

slorber commented Aug 26, 2021

Doesnt the docs only mode preclude the inclusion of other pages, though? Having a docs page as the landing page does not necessarily mean that you dont want pages such as the original index page, does it?

You should be able to keep using standalone pages even with docs: {routeBasePath: '/',}.
In this case, you just don't want to have a doc with slug: / otherwise it would be overridden by your pages/index.js.

I can confirm it works for the docusaurus site, both standalone pages + doc pages are accessible, without the /docs/ prefix:

image

image

Standalone pages are always routed in priority compared to plugins using routeBasePath which are using "subroutes" under /routeBasePath/*.

@sporritt
Copy link

Ok cool. Thanks for following up.

@symbolpunk
Copy link

@slorber is there any way to use docs-only mode while retaining a descriptive slug for the "landing page" doc?

I'd like to default a docs site to a particular doc (no landing page) while retaining a descriptive slug for SEO. docs.foo.com should redirect to docs.foo.com/intro-somekeyword and then other docs routes should look like docs.foo.com/other-doc. Is this possible?

@slorber
Copy link
Collaborator

slorber commented Dec 21, 2022

@symbolpunk this is best achieved by a server redirect. GitHub Pages does not support it, but others usually do.

Gnuxie added a commit to the-draupnir-project/draupnir-documentation that referenced this issue May 24, 2024
facebook/docusaurus#1253
facebook/docusaurus#1253 (comment)

We're not going to have a blog on a website called Draupnir Documentation
are we.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants