next-theme / hexo-theme-next

🎉 Elegant and powerful theme for Hexo.
https://theme-next.js.org
Other
2.41k stars 426 forks source link

prevents anchor to be added to url #327

Closed maple3142 closed 3 years ago

maple3142 commented 3 years ago

Please follow this Issue template to provide relevant information, such as source code repository, website URL and screenshots, which will help us investigate. 请按照此 Issue 模版提供相关信息,例如源码仓库、网站链接和屏幕截图,这将有助于我们进行调查。

Issue Checklist


Expected behavior

Clicking a link in TOC not only scrolls to the target, the id should be added to fragment part (#id part). This is how normal browser behaves when clicking a link like #id. (https://jsfiddle.net/4ytoxhjw/1/)

Actual behavior

Steps to reproduce the behavior

  1. Goto https://theme-next.js.org/docs/getting-started/installation.html
  2. Click 2. Get NexT in TOC
  3. The url still ishttps://theme-next.js.org/docs/getting-started/installation.html rather than https://theme-next.js.org/docs/getting-started/installation.html#Get-NexT

It seems to caused by this line: https://github.com/next-theme/hexo-theme-next/blob/2329059cbd301ef17c71f55ac6bd7dbb90d927f8/source/js/utils.js#L272

Environment Information

Node.js and NPM Information

Package dependencies Information

Hexo Configuration

NexT Configuration

Other Information

Chrome 91.0.4472.124

github-actions[bot] commented 2 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. It is possible issue was solved or at least outdated. Feel free to open new for related bugs.