Skip to content

Search on pages with spaces creates invalid links #1956

@sbonds

Description

@sbonds

I checked that...

  • ... the documentation does not mention anything about my problem
  • ... the problem doesn't occur with the default MkDocs template
  • ... the problem is not in any of my customizations (CSS, JS, template)
  • ... there are no open or closed issues that are related to my problem

Description

When search results include an URL with spaces in its name the resulting search result link does not exist.

Expected behavior

Search results will contain links to the content containing search hits even if the page URLs have spaces in them.

Actual behavior

The results of a search has the spaces (%20) in URLs replaced by '+' which is no longer a valid link.

Steps to reproduce the bug

  1. Go to the demo site created at https://sbonds.github.io/mkdocs-simple-demo/
  2. Search for "spaces"
  3. Follow the link to "doc file with spaces"
  4. Observe the mangled 404 page at https://sbonds.github.io/mkdocs-simple-demo/doc+file+with+spaces/

Package versions

The build is automated via https://github.com/sbonds/mkdocs-simple-demo/blob/master/.travis.yml

  • Python: Python 3.7.1
  • MkDocs: mkdocs, version 1.1.2 from /home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/mkdocs (Python 3.7)
  • Material: Version: 6.0.1

Project configuration

The whole thing is available at https://github.com/sbonds/mkdocs-simple-demo/blob/master/mkdocs.yml

This is intentionally simplified to provide a testbed for issues observed in a much more complex environment.

site_name: Simple public demo for mkdocs
nav:
- home: index.md
theme: 
  name: material
  palette:
    primary: 'white'
    accent: 'blue'
  features:
    # https://squidfunk.github.io/mkdocs-material/upgrading/#upgrading-from-5x-to-6x
    - navigation.tabs
repo_url: https://github.com/sbonds/mkdocs-simple-demo
repo_name: 'GitHub'
edit_uri: tree/master/docs/
extra:
  contact:
    name: 'Steve Bonds'
    email: 'sbonds@gmail.com'
markdown_extensions:
- mdx_truly_sane_lists

System information

Web client info:

  • OS: Windows 10
  • Browser: Chrome 85.0.4183.121

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue reports a bugresolvedIssue is resolved, yet unreleased if open

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions