mkdocs-material: Links in tags index to tagged pages are incorrect on Windows

Contribution guidelines

I’ve found a bug and checked that …

  • … the problem doesn’t occur with the mkdocs or readthedocs themes
  • … the problem persists when all overrides are removed, i.e. custom_dir, extra_javascript and extra_css
  • … the documentation does not mention anything about my problem
  • … there are no open or closed issues that are related to my problem

Description

Adding support for tags in a subfolder in my documentation project did cause warnings at mkdocs serve. Additionally the tag links, from the tags.md inside subfolder, are not working and showing the 404 not found page.

Expected behaviour

Using tags.md in a subfolder should not cause warning as mkdocs serve building time & tag links should work.

Actual behaviour

Using tags.md in a subfolder cause warning & tag links do not work (404 not found)

(venv) PS C:\test\mkdocs test> mkdocs serve
INFO     -  Building documentation...
INFO     -  Cleaning site directory
WARNING  -  Documentation file 'getting-started\tags.md' contains a link to 'getting-started\getting-started\getting-started.md' which is not found in
            the documentation files.
WARNING  -  Documentation file 'getting-started\tags.md' contains a link to 'getting-started\getting-started\getting-started.md' which is not found in   
            the documentation files.
WARNING  -  Documentation file 'getting-started\tags.md' contains a link to 'getting-started\getting-started\getting-started.md' which is not found in   
            the documentation files.
WARNING  -  Documentation file 'getting-started\tags.md' contains a link to 'getting-started\getting-started\getting-started.md' which is not found in   
            the documentation files.
WARNING  -  Documentation file 'getting-started\tags.md' contains a link to 'getting-started\getting-started\getting-started.md' which is not found in   
            the documentation files.
WARNING  -  Documentation file 'getting-started\tags.md' contains a link to 'getting-started\getting-started\getting-started.md' which is not found in   
            the documentation files.
WARNING  -  Documentation file 'getting-started\tags.md' contains a link to 'getting-started\getting-started\getting-started.md' which is not found in   
            the documentation files.
WARNING  -  Documentation file 'getting-started\tags.md' contains a link to 'getting-started\getting-started\getting-started.md' which is not found in   
            the documentation files.
INFO     -  Documentation built in 0.22 seconds
INFO     -  [11:46:54] Watching paths for changes: 'docs', 'mkdocs.yml'
INFO     -  [11:46:54] Serving on http://127.0.0.1:8000/
INFO     -  [11:47:07] Browser connected: http://127.0.0.1:8000/
INFO     -  [11:47:12] Browser connected: http://127.0.0.1:8000/getting-started/getting-started/
INFO     -  [11:47:14] Browser connected: http://127.0.0.1:8000/getting-started/tags/
WARNING  -  [11:47:16] "GET /getting-started/tags/getting-started/getting-started.md HTTP/1.1" code 404

Steps to reproduce

  1. Create a simple mkdocs.yml with tags and tags_file support (see below with the yml file I am using)
  2. Create the tags.md page in a ‘getting-started’ subfolder and reference in the mkdocs.yml
  3. Run mkdocs serve

Package versions

  • Python: python 3.9.7
  • MkDocs: mkdocs 1.3.0
  • Material: version 8.2.12

Configuration

site_name: 'Test Tags'
site_description: 'Description'
site_author: 'Company'

nav:
  - Home:
    - Introduction: index.md
    - Getting Started:
        - getting-started/getting-started.md
        - Tags: getting-started/tags.md

theme:
  name: 'material'

markdown_extensions:
  - meta

plugins:
  - search:
      prebuild_index: false
  - tags:
      tags_file: getting-started/tags.md

System information

  • Operating system: windows
  • Browser: Chrome

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (8 by maintainers)

Most upvoted comments

Thank you for your swift investigation & solution. Even on a Sunday & holiday (labor day). Dedication I would say!

Thank you again.