Docusaurus: [v2] Support index.md filenames / IDs

Created on 5 Apr 2020  路  6Comments  路  Source: facebook/docusaurus

馃殌 Feature

Docusaurus v1 had a feature where creating an index.md file would generate an index.html file at the same, relative, directory path:

+ docs
   + getting-started
      + index.md (id: index)

generates

+ docs
   + getting-started
      + index.html

In v2, creating - using the docs plugin - an index.md file results in a structure of index/index.html.

+ docs
   + getting-started
      + index.md (id: index)

generates

+ docs
   + getting-started
      + index
        + index.html

This requires calling http://foo.bar/docs/getting-started/index or even http://foo.bar/docs/getting-started/index.html which is probably not intentional.

Have you read the Contributing Guidelines on issues?

yes

Motivation

Directory structure is important for SEO. Additionally, the index behavior is weird and (I think) unintentional as one ends up with urls like: http://foo.bar/docs/getting-started/index or http://foo.bar/docs/getting-started/index.html.

Pitch

I think Docusaurus v1 solved this correctly and this should be ported into v2 as well!

intermediate feature mlh

Most helpful comment

Maybe getting-started was a bad example, let's take:

+ docs
  + index.md <- this one especially
  + sdks
    + index.md
    + golang.md
    + node.md
+ ...

All 6 comments

Sure, we're open to this. But why don't you create getting-started.md instead?

Maybe getting-started was a bad example, let's take:

+ docs
  + index.md <- this one especially
  + sdks
    + index.md
    + golang.md
    + node.md
+ ...

Makes sense 馃憤

I could try to help, although I would need pointers because I've never worked with docusaurus internals.

This becomes more acute when we run Docusaurus in "docs only" mode because we can't generate the index.html of the root directory. There's also #1973 which is a symptom of this issue IMO, but the proposed workaround https://github.com/facebook/docusaurus/issues/1973#issuecomment-554063866 does not work when using docs only mode!

A solution similar to vuepress would be nice. If the /docs directory has a README.md file it should be at foo.bar/docs/ and not foo.bar/docs/README. And in 'docs only' mode, The README.md contents should be displayed at foo.bar/. This would be only if there is a README.md file in the docs/ directory

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chandankumar4 picture chandankumar4  路  3Comments

MoogyG picture MoogyG  路  3Comments

rickyvetter picture rickyvetter  路  3Comments

muuvmuuv picture muuvmuuv  路  3Comments

philipmjohnson picture philipmjohnson  路  3Comments