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

[v2] Support index.md filenames / IDs #2537

Closed
aeneasr opened this issue Apr 5, 2020 · 9 comments · Fixed by #5830
Closed

[v2] Support index.md filenames / IDs #2537

aeneasr opened this issue Apr 5, 2020 · 9 comments · Fixed by #5830
Labels
difficulty: intermediate Issues that are medium difficulty level, e.g. moderate refactoring with a clear test plan. feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future. mlh Major League Hacking Fellowship

Comments

@aeneasr
Copy link
Contributor

aeneasr commented Apr 5, 2020

🚀 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!

@aeneasr aeneasr 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 Apr 5, 2020
@yangshun yangshun removed the status: needs triage This issue has not been triaged by maintainers label Apr 5, 2020
@yangshun
Copy link
Contributor

yangshun commented Apr 5, 2020

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

@aeneasr
Copy link
Contributor Author

aeneasr commented Apr 5, 2020

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

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

@yangshun
Copy link
Contributor

yangshun commented Apr 5, 2020

Makes sense 👍

@aeneasr
Copy link
Contributor Author

aeneasr commented Apr 5, 2020

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

@aeneasr
Copy link
Contributor Author

aeneasr commented Apr 6, 2020

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 #1973 (comment) does not work when using docs only mode!

@maximousblk
Copy link

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

@yangshun yangshun added difficulty: intermediate Issues that are medium difficulty level, e.g. moderate refactoring with a clear test plan. mlh Major League Hacking Fellowship labels Jun 5, 2020
guyca pushed a commit to wix/react-native-navigation that referenced this issue Aug 31, 2020
Fixes #6495 

This allows website code snippets to be build with `tsc` reducing their error proneness.

I converted all code snippets tagged with `tsx?` to separate files. There are other snippets tagged as `jsx?` which I did not convert (yet, at least out of scope for this pr).

The chosen directory structure represents the ability to colocate snippets with their respective `.mdx` file. However, we can't move the `.mdx` files into the folder and name them `index.mdx` because that is not supported by docusaurus yet. See facebook/docusaurus#2537

The last commit makes changes to the snippets to make them build. I did not modify the mobx snippets (so they error out at the moment) as I have never used mobx. Somebody else needs to take care of them.

The build can be triggered with the npm / yarn task `snippets:build` in the `website` directory. Later on we should add this to the build pipeline so that errors out if the snippets / rnn lib code are out of sync.
@slorber
Copy link
Collaborator

slorber commented Jun 10, 2021

This issue totally make sense, it will likely be implemented as part of the "sidebar category index" feature: #2643

@slorber
Copy link
Collaborator

slorber commented Dec 2, 2021

Implemented as part of #5830

@slorber
Copy link
Collaborator

slorber commented Dec 3, 2021

please test it in the latest canary and tell us if it works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty: intermediate Issues that are medium difficulty level, e.g. moderate refactoring with a clear test plan. feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future. mlh Major League Hacking Fellowship
Projects
None yet
4 participants