Skip to content

Title customization for root element. #745

Closed
@Edgar-Spiir

Description

@Edgar-Spiir

Not sure if I'm misunderstanding something or perhaps there's actual issue with this.

Default behavior for title generation as noticed is this - {.md's first headline} - {title defined in index.html}

Scenario: I don't use a cover page, my home page is README.md at root of served directory. In my index.html I define a title with value Documentation.

Home's README.md:

# Home

Other content

My Sidebar:

* **Getting Started**
  * [Home](/)
......

Docsify config:

ga: 'ga code',
auto2top: true,
executeScript: true,
loadSidebar: true,
maxLevel: 3,
subMaxLevel: 2,
themeColor: "#19225B",

Expected behavior: When I navigate to root (e.g. localhost:3000/#/ ), I should see a title Home - Documentation

Actual behavior: When I navigate to root, I see title - Documentation

What's even worse is that even when tried making a workaround with defining a script in home page's markdown to change a title when document finished loading it didn't work on initial load. It works when i navigate somewhere else and when navigate to home through sidebar, but if I refresh home, when the title is once again - Documentation

From this I can see 2 possible future fixes:

  • Fix titles for root pages
  • Don't add the dash to the title if left side is empty, so that, if going back to my example, instead of - Documentation, it would Documentation at least.

I will probably try to solve this within docsify and make PR if I succeed, but to be fully honest, I'm not much of a JS developer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions