Allow README.md to be used as the index page#619
Allow README.md to be used as the index page#619SEJeff wants to merge 1 commit intomkdocs:masterfrom SEJeff:add-readme-as-index
Conversation
If index.md exists, it will be preferenced over README.md, to match the featureset of [readthedocs](https://github.com/rtfd/readthedocs.org/blob/347104f25c82bba0c42029a2226cbbb71a0bf627/readthedocs/doc_builder/base.py#L89-L103) as the index page. Fixes #608
There was a problem hiding this comment.
The path.replace could likely be better, but again, I figured it was easier to get a yay or nay on the approach and go from there before this gets merged.
|
This looks reasonable, I am not 100% sure what will happen if you have both an index and a README file tho' - presumably one will write over the other and the page will be lost? |
|
Okay, so I have tested this with the MkDocs documentation.
I think having both is going to be a relatively uncommon use-case, but probably still a valid one. FWIW, this is what I see. Regardless of if I click on Home or README the README nav is highlighted and the README page is shown (I modified the title so I knew). |
|
I am also trying to figure out what documentation changes are required. It seems we never explicitly state that an index.md is required. So I would suggest just adding a brief mention in the docs here to say something like...
|
|
I am trying to think how we can better approach this issue. The problem is that where we set the output path, we don't have any context of what other pages exist. |
|
I'm going to close this for now. This clearly will need a lot more work. |
|
@SEJeff Thanks for your effort, it might be something like this would be easier with @tomchristie's factoring. I don't think it is specifically a goal of his, but he might have some ideas. |
|
Actually the 'refactor' branch does already handle this. I'm not too concerned about clashing 'index.md' and 'README.md' files, simply warning if this occurs would be sufficient, and also be easy to do. |
|
Awesome. My main motivation for this is that it is a common GitHub pattern, ReadTheDocs hacks support in for people as it is. |

If index.md exists, it will be
preferenced over README.md, to match the featureset of readthedocs as the index page.
Fixes #608
I'm not sure what you require as far as documentation goes, but first wanted to make sure this, or something like it is reasonable. I used the maxsplit argument to
str.split(), so there shouldn't be any unexpected surprises.