Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate header with autoHeader and loadSidebar set to true #29

Open
nicolas-goudry opened this issue Dec 3, 2021 · 1 comment
Open

Comments

@nicolas-goudry
Copy link

I found that there’s an odd bug with docsify-darklight-theme plugin, whether it’s used with or without docsify-themeable.

If you setup a raw docsify project:

npx docsify init ./test-docs

And edit docsify’s options in index.html:

window.$docsify = {
  loadSidebar: true,
  autoHeader: true
}

Then create the following _sidebar.md:

- [Title 1](/autotitle.md)
- [Title 2](/customtitle.md)

With the following pages:

autotitle.md

This page has an auto-generated title.

customtitle.md

# My custom title

This page has a custom title.

When loaded, the autotitle.md will have an auto-generated title matching its link text from _sidebar.md.

auto-title-default

When loaded, the customtitle.md will keep its custom title.

custom-title-default


However, after docsify-darklight-theme setup, the customtitle.md will have two main titles:

  • the one from the sidebar
  • the one from its content

custom-title-darklight

I find this behavior very strange and can’t understand where it’s coming from… I heavily rely on the default behavior in order to have short links in my sidebar with more detailed page titles.

For now, I will disable the autoHeader feature and manually provide page titles, but I’d really like to use the default behavior with docsify-darklight-theme… If you could look into this, it would be greatly appreciated!

Thanks 🙂

@nicolas-goudry
Copy link
Author

I found what’s triggering this behaviour.

On docsify’s afterEach hook, the div holding theme switch button is added before page content. This prevents docsify to detect that a custom page title has been set.

To solve this issue, the div needs to be added after page content. This doesn’t change the theme switch button position on page, given its absolute positioning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant