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

The "Skip to content" link is invalid except in the top page #899

jessitron opened this Issue Oct 12, 2018 · 3 comments


None yet
2 participants

jessitron commented Oct 12, 2018


HtmlProofer has kindly identified that every "Skip to content" link in my site is invalid except the top-level index. You can see this on your own site: right now, the page contains the link:

<a href="../#customization" tabindex="1" class="md-skip">
        Skip to content

and ../#customization is invalid. It should be "#customization"

Expected behavior

All generated links on the page should be valid links.

Actual behavior

In this line of code:

<a href="{{ (page.toc | first).url | url }}" tabindex="1" class="md-skip">

it does:

href="{{ (page.toc | first).url | url }}"

and that url filter turns "#internal-anchor" into "../#internal-anchor" for a top-level non-index page like Customization. For a page deeper in the docs directory it puts more ../ path components.

Unfortunately the url filter thinks #internal-anchors are absolute from the base, or something. I reported it to mkdocs: mkdocs/mkdocs#1655 . There are no tests for that filter in the mkdocs repo :-(

meanwhile, you don't need to pass that url to that filter as far I can tell.

Steps to reproduce the bug

  1. Go to
  2. Look at the HTML
  3. Search for "Skip to content"
  4. Observe the invalid href: "../#customization"

Currently, your gh-pages branch says: "Deployed fa8d490 with MkDocs version: 1.0.4"

Package versions

  • Python: 3.6.0
  • MkDocs: 1.0.4
  • Material: 3.0.4

Project configuration

... it shows up in your own ...

System information

  • OS: Mac
  • Browser: Firefox

This comment has been minimized.


squidfunk commented Oct 12, 2018

Thanks for reporting, that's indeed a bug! We should just remove the filter, as you already said. I'm currently on holiday, so expect a fix to land at the end of next week.

PS: that's a great issue. Would love to see more written like this as opposed to "I have error pls fix thx"

@squidfunk squidfunk added the bug label Oct 18, 2018


This comment has been minimized.


squidfunk commented Oct 23, 2018

Fixed in 13a76c4. Will be part of next release. Thanks for your time in researching the problem and solution!


This comment has been minimized.


squidfunk commented Oct 23, 2018

Released as part of 3.0.5

@squidfunk squidfunk closed this Oct 23, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment