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

[Bug report] Hash is appended when switching page #693

Closed
Mister-Hope opened this issue Feb 14, 2022 · 1 comment
Closed

[Bug report] Hash is appended when switching page #693

Mister-Hope opened this issue Feb 14, 2022 · 1 comment
Assignees

Comments

@Mister-Hope
Copy link
Member

Mister-Hope commented Feb 14, 2022

E.g. when visiting https://v2.vuepress.vuejs.org/zh/guide/page.html

You will find out that the page loads and changed to https://v2.vuepress.vuejs.org/zh/guide/page.html#路由

While https://v2.vuepress.vuejs.org/zh/guide/configuration.html won't


Problem

The @vuepress/plugin-active-header-links should special treat and understand <h1> tags, unless the first non <h1> heading reaches top, the plugin should remain the url "hash clean"


Possible solution

vuepress-theme-hope@v1 is using a improved plugin @mr-hope/vuepress-plugin-active-hash forked from @vuepress/plugin-active-hash.

See https://vuepress-theme-hope.github.io/guide/get-started/intro/ as a demo, the plugin will try to empty the hash when scrolling to top, that should be the expect behavior.


Edited:

The current behavior fit most situation, becuase the plugin won't try to scroll page if the hash match the first heading.

But it will have problems when a page has a long excerpt:

# Title

A long excerpt with lots of text and paragraph.

.....

## The first h2 is at the bottom of the page.
@Mister-Hope Mister-Hope changed the title [Bug report] Hash is appened when switching page [Bug report] Hash is appended when switching page Feb 14, 2022
@github-actions
Copy link

This issue is marked as stale because it has not had recent activity. Issues marked with stale will be closed if they have no activity within 3 days.

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

No branches or pull requests

1 participant