Mkdocs-material: Instant loading doesn't update the page title correctly

Created on 27 Oct 2020  路  3Comments  路  Source: squidfunk/mkdocs-material

__I've found a bug and checked that ...__

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

Description

When navigation.instant is enabled, internal links in the docs site won't refresh correctly the title of the page/tab/window

Expected behavior

Site title always matches the current page, and updates along with the new pages you click.

Actual behavior

Site title skips the first page update, and from that point, every time you go to another page, the title updates to the previous page (it's always "one page behind you"). Refreshing with F5 updates the title correctly, but then the issue starts again as soon as you go to another page.

Steps to reproduce the bug

  1. Enable the navigation.instant feature
  2. Go to the docs site. TItle matches current (first) page.
  3. Go to a second page. Title still matches first page.
  4. Go to a third page. Title now matches second page.
  5. Go to a fourth page. Title now matches third page.
  6. Refresh the site. Title matches the current page.
  7. Repeat step 2.

Package versions

  • Python: 3.9.0
  • MkDocs: 1.1.2
  • Material: mkdocs-material-6.1.0+insiders-1.7.0

Project configuration

# Appearance
theme:
  name: material
  custom_dir: theme
  logo: assets/img/logo.png
  favicon: assets/img/favicon.png
  font:
    text: PT Sans
    code: PT Mono
  palette:
    - scheme: slate
      primary: deep purple
      accent: deep purple
      toggle:
        icon: material/weather-night
        name: Switch to dark mode
    - scheme: default
      primary: deep purple
      accent: deep purple
      toggle:
        icon: material/weather-sunny
        name: Switch to light mode
  features:
    - navigation.instant
    - navigation.tabs
#   - header.hide # Insiders
#   - search.highlight # Insiders
#   - toc.autohide # Insiders

# Plugins
plugins:
  - search
  - minify:
      minify_html: true
  - git-revision-date-localized:
      type: timeago
      fallback_to_build_date: true

# Extensions
markdown_extensions:
  - admonition
  - def_list
  - meta
  - pymdownx.details
  - pymdownx.emoji:
      emoji_index: !!python/name:materialx.emoji.twemoji
      emoji_generator: !!python/name:materialx.emoji.to_svg
  - pymdownx.extra
  - pymdownx.highlight
  - pymdownx.inlinehilite
  - pymdownx.keys:
      separator: ' + '
  - pymdownx.mark
  - pymdownx.smartsymbols
  - pymdownx.striphtml
  - pymdownx.superfences
  - pymdownx.tabbed
  - pymdownx.tilde
  - pymdownx.tasklist:
      custom_checkbox: true
  - toc:
      separator: "-"
      permalink: '#'
      toc_depth: 3

System information

  • OS: Windows 10 20H2
  • Browser: Firefox 83.0b (although tried others)
bug fix available

All 3 comments

Thanks for reporting! Shouldn't be too hard too fix.

Fixed in 87b706f1.

Released as part of 6.1.1.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

LinusGeffarth picture LinusGeffarth  路  3Comments

michael-nok picture michael-nok  路  3Comments

40huo picture 40huo  路  3Comments

oliverschwendener picture oliverschwendener  路  4Comments

nikramakrishnan picture nikramakrishnan  路  3Comments