8000 Versioning outdated banner and instant loading odd behaviour · Issue #3653 · squidfunk/mkdocs-material · GitHub
[go: up one dir, main page]

Skip to content

Versioning outdated banner and instant loading odd behaviour #3653

@ajstewart

Description

@ajstewart

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

I'm creating this issue after asking the previous question found here in the discussions section: #3617

On further digging, I've found that when using the combination of mike versioning, outdated banner override and instant loading, the suggested outdated banner url does not work as expected.

To be clear, the suggested outdated banner is that below which is stated in the docs on https://squidfunk.github.io/mkdocs-material/setup/setting-up-versioning/#version-warning

{% extends "base.html" %}

{% block outdated %}
  You're not viewing the latest version.
  <a href="{{ '../' ~ base_url }}"> 
    <strong>Click here to go to latest.</strong>
  </a>
{% endblock %}

This only happens when the initial load is performed on the homepage.

If you hard-refresh, or load in directly to a page, the banner link works throughout. It is only when the home page is the initial load.

I have created a simple example site (see reproducing section).

Expected behaviour

That when clicking the outdated banner the link should direct to the root address and therefore take you to the default latest version.

Actual behaviour

The current behaviour is that the outdated banner link is not resolving properly with instant loading when the homepage is the initial entry point. When visiting another page in the site after this entry point, the banner link will attempt to go to the wrong address and 404.

Steps to reproduce

I have created a simple dummy docs site hosted here: https://ajstewart.github.io/mkdocs-material-version-test/

Repository here: https://github.com/ajstewart/mkdocs-material-version-test

These were deployed with (both versions are the same):

mike deploy v1.0 --push
mike deploy v2.0 latest --push
mike set-default latest --push
  1. Navigate to the hosted site above.
  2. While on the homepage, switch to v1.0.
  3. Navigate to another page in the docs.
  4. Click the outdated banner.

Package versions

  • Python: 3.8.12
  • MkDocs: 1.2.3
  • Material: 8.2.3

Configuration

site_name: My Docs
site_url: https://ajstewart.github.io/mkdocs-material-version-test/
site_dir: site

theme:
  name: material
  features:
    - navigation.instant
    - navigation.tabs
    - navigation.sections
  custom_dir: overrides

extra:
  version:
    provider: mike

nav:
  - Home: index.md
  - Section A:
    - FOO: pages/foo.md
    - BAR: pages/bar.md
  - Section B:
    - NEW: pages/new.md


### System information

- Operating system: macOS 12.2.1
- Browser: Microsoft Edge 98.0.1108.51

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

      0