Skip to content

[Bug] Link to different port number marked as active in Modern template #11023

Description

@vbluhme

Describe the bug
I host a DocFX site and a webapp on two different ports on the same hostname. I added a link to the webapp to the header navigation toc.yml of my DocFX site. Now the link is marked Active on the DocFX homepage, and a breadcrumb with the (external) link is added above the index.html title.

The fix is a one-line change to isExternalHref to mark URLs with different port numbers as external: https://github.com/dotnet/docfx/blob/main/templates/modern/src/helper.ts#L77

Required change: 01d296e

To Reproduce
Steps to reproduce the behavior:

  1. Create default DocFX site with Modern template
  2. Add link to http://localhost:1234 to toc.yml
  3. docfx --serve --open-browser
  4. DocFX treats http://localhost:1234 as identical to http://localhost:8080 and marks the link active

Expected behavior
URLs with different port numbers from the current site should be marked as external and therefore not be active.

Context (please complete the following information):

  • Browser: Edge
  • Form factor: Desktop
  • Docfx version: 2.78.5
  • Template: modern

Metadata

Metadata

Assignees

No one assigned

    Labels

    templateThe stock site template

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions