mkdocs / mkdocs-redirects

Open source plugin for Mkdocs page redirects
MIT License
176 stars 25 forks source link

Redirect readme.md to index.md creates redirect loop #36

Closed drts01 closed 2 years ago

drts01 commented 2 years ago

I believe v1.0.4 resolves issue #24, but introduces the same result when use_directory_urls is set to false.

use_directory_urls: false

theme:
  name: "material"

plugins:
- redirects:
    redirect_maps:
      index.md: readme.md
oprypin commented 2 years ago

Sorry, it isn't immediately clear to me what you mean.

So you're saying there is a problem, and to reproduce it it is enough to just create this config, no actual doc files necessary.

And what exactly is the issue (expected result vs actual result)?

oprypin commented 2 years ago

Ah it's in the title, I missed that

Redirects to nested README.md/index.md

that'd be "actual"

and "expected" would be redirects to... wait what? Aren't these two paths equivalent in the result, meaning that the redirect is not needed?

drts01 commented 2 years ago

I am trying to achieve a structure like:

use_directory_urls: false

theme:
  name: "material"
  features:
    - navigation.indexes
    - navigation.tabs
    - navigation.top

plugins:
  - redirects:
      redirect_maps:
        index.md: readme.md

nav:
  - Home:
    - Readme: readme.md
    - Changelog: changelog.md
    - Contributing: contributing.md
    - License: license.md
  - Source: code/

This works for me in v1.0.3 because the readme check use to happen only if use_directory_urls was True. https://github.com/mkdocs/mkdocs-redirects/commit/d983418602ed80694982942898459553075f9f50#diff-e301f7075814e13e828bc2c0c891570d8429bcc915cbb25854f3715aeadee276R76-R82

I have opened an issue with Mkdocs to determine the proper behavior of readme.md, mkdocs/mkdocs#2846