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

README.md in theme directory overrides index.md in docs #1766

Closed
ruuda opened this issue Mar 10, 2019 · 1 comment
Closed

README.md in theme directory overrides index.md in docs #1766

ruuda opened this issue Mar 10, 2019 · 1 comment

Comments

@ruuda
Copy link

@ruuda ruuda commented Mar 10, 2019

Summary

MkDocs will generate index.html from README.md in the theme directory, even if index.md exists in the docs directory.

Steps to reproduce

Consider the following minimal example:

├── docs
│   └── index.md
├── mkdocs.yml
└── theme
    ├── main.html
    └── README.md

docs/index.md:

The right index.

theme/README.md:

The wrong index.

theme/main.html:

{{ page.content }}

mkdocs.yml:

site_name: Repro
theme:
  name: null
  custom_dir: theme
nav:
  - Overview: index.md

After running mkdocs build, the following index.html is produced:

<p>The wrong index.</p>

Furthermore, mkdocs build emits the following message:

INFO    -  The following pages exist in the docs directory, but are not included in the "nav" configuration:
  - README.md 

This is especially surprising, because the the docs say:

If both an index.md file and a README.md file are found in the same directory, then the index.md file is used and the README.md file is ignored.

I would expect markdown files in the theme directory to not affect how the documentation is built, unless they are specifically included from a template.

$ mkdocs --version
mkdocs, version 1.0.4 from /usr/lib/python3.7/site-packages/mkdocs (Python 3.7)
@waylan
Copy link
Member

@waylan waylan commented Mar 13, 2019

I expect this was fixed in #1672, which will be available in the next release. However, it occurs to me that perhaps we should exclude all Markdown files from the theme directory, or at least README files. A Theme should not be able to add "pages" to a site and README files in a theme would not be content either.

waylan added a commit to waylan/mkdocs that referenced this issue Mar 13, 2019
@waylan waylan closed this in #1767 Mar 13, 2019
waylan added a commit that referenced this issue Mar 13, 2019
Account for capitalization differences and all supported Markdown extensions. Fixes #1766.
ruuda added a commit to ruuda/kilsbergen that referenced this issue Jun 27, 2021
Previously it could not be called README.md, due to a bug in MkDocs [1].
This bug has been fixed in version 1.1, which was released earlier this
year.

[1]: mkdocs/mkdocs#1766
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants