Skip to content

Comments

Allow README.md to be used as the index page#619

Closed
SEJeff wants to merge 1 commit intomkdocs:masterfrom
SEJeff:add-readme-as-index
Closed

Allow README.md to be used as the index page#619
SEJeff wants to merge 1 commit intomkdocs:masterfrom
SEJeff:add-readme-as-index

Conversation

@SEJeff
Copy link

@SEJeff SEJeff commented Jun 9, 2015

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.

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
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That seems reasonable to me.

@d0ugal
Copy link
Member

d0ugal commented Jun 9, 2015

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?

@d0ugal
Copy link
Member

d0ugal commented Jun 9, 2015

Okay, so I have tested this with the MkDocs documentation.

  • If I just rename the index.md it works pretty great
  • We probably need to update this too. I forget exactly where it is used, but it will show Home in the nav rather than README.
  • If I duplicate the index.md to README.md we run into some issues.
    • We have two navigation items that point to the same location.
    • The homepage shows the README.md and the index.md isn't accessible.

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).

screenshot

@d0ugal
Copy link
Member

d0ugal commented Jun 9, 2015

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...

MkDocs will use the index.md file for your home page, if that isn't found it will also try README.md

@d0ugal
Copy link
Member

d0ugal commented Jun 9, 2015

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.

@SEJeff
Copy link
Author

SEJeff commented Jul 9, 2015

I'm going to close this for now. This clearly will need a lot more work.

@SEJeff SEJeff closed this Jul 9, 2015
@d0ugal
Copy link
Member

d0ugal commented Jul 9, 2015

@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.

@lovelydinosaur
Copy link
Member

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.

@d0ugal
Copy link
Member

d0ugal commented Jul 9, 2015

Awesome. My main motivation for this is that it is a common GitHub pattern, ReadTheDocs hacks support in for people as it is.

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

Successfully merging this pull request may close these issues.

3 participants