hexo icon indicating copy to clipboard operation
hexo copied to clipboard

Prefix anchors by post path

Open PaperStrike opened this issue 4 years ago • 2 comments

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.

PaperStrike avatar Apr 24 '21 11:04 PaperStrike

How to test

git clone -b prefix-anchor https://github.com/PaperStrike/hexo.git
cd hexo
npm install
npm test

github-actions[bot] avatar Mar 27 '22 18:03 github-actions[bot]

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.

stevenjoezhang avatar Apr 14 '24 02:04 stevenjoezhang