Skip to content

[Bug] Modern template always sets the first navbar element as active #9877

@MiTschMR

Description

@MiTschMR

Describe the bug
The modern template sets the first navbar element always as active. It seems to disregard parts of the path in the url to fully check if the path matches and only then set it active.

To Reproduce
Steps to reproduce the behavior:

  1. Add an index.md in the root directory and reference it
  2. Add subfolders with elements
  3. Add a toc.yml in the root directory only referencing the subfolder toc's

Expected behavior
The first element in the navbar (meaning a subfolder) should not be set to active.

Context (please complete the following information):

  • OS: Windows 11
  • Docfx version: 2.76.0

Additional context
The default theme does not have this issue.

docfx.json:

{
  "build": {
    "globalMetadata": {
      "_appFooter": "<span>Copyright © 2024 MiTschMR Studios<br>Generated by <strong>DocFX</strong></span>"
    },
    "content": [
      {
        "files": [
          "toc.yml",
          "index.md",
          "releases.md"
        ]
      },
      {
        "src": "authentication",
        "files": [
          "toc.yml",
          "*.md",
          "**/*.md"
        ],
        "dest": "authentication"
      },
      {
        "src": "polls",
        "files": [
          "toc.yml",
          "*.md",
          "**/*.md"
        ],
        "dest": "polls"
      },
      {
        "src": "rewards",
        "files": [
          "toc.yml",
          "*.md",
          "**/*.md"
        ],
        "dest": "rewards"
      },
      {
        "src": "streams",
        "files": [
          "toc.yml",
          "*.md",
          "**/*.md"
        ],
        "dest": "streams"
      },
      {
        "src": "users",
        "files": [
          "toc.yml",
          "*.md",
          "**/*.md"
        ],
        "dest": "users"
      }
    ],
    "resource": [
      {
        "files": [
          "resources/**/*",
          "logo.svg",
          "favicon.ico",
          "versions.json"
        ]
      }
    ],
    "template": [ "default", "modern", "templates/material" ],
    "dest": "_site"
  }
}

toc.yml (root):

- name: Authentication
  href: authentication/
- name: Rewards
  href: rewards/
- name: Streams
  href: streams/
- name: Users
  href: users/
- name: Releases
  href: ./releases.md

Website with modern template:
image

Website with default template (built with version 2.66.0):
https://mitschmr-studios.io/documentation/twitch/

Metadata

Metadata

Assignees

No one assigned

    Labels

    templateThe stock site template

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions