Skip to content

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

@ruuda

Description

@ruuda

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions