hexo
hexo copied to clipboard
Prefix anchors by post path
What does it do?
Resolve #1302 by using post path and url_for on post anchors.
How to test
Test cases will be added later. Code below fails currently.
git clone -b prefix-anchor https://github.com/PaperStrike/hexo.git
cd hexo
npm install
npm test
Screenshots
Pull request tasks
- [ ] Add test cases for the changes.
- [ ] Passed the CI test.
How to test
git clone -b prefix-anchor https://github.com/PaperStrike/hexo.git
cd hexo
npm install
npm test
I realize that this does not solve the problem, as the link on the homepage will still point to inside the article. When readers click the anchor on the homepage, it will jump (rather than scroll to the corresponding position on the homepage). We can make it unique by adding the post's hash to the anchor name when generating the post.excerpt.