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

Prefix anchors by post path #4687

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

PaperStrike
Copy link

@PaperStrike PaperStrike commented Apr 24, 2021

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.

@github-actions github-actions bot added the stale label Nov 28, 2021
@github-actions github-actions bot closed this Dec 6, 2021
@github-actions
Copy link

How to test

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

@uiolee uiolee added the javascript Pull requests that update Javascript code label Jan 12, 2024
@stevenjoezhang
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
javascript Pull requests that update Javascript code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Anchors in individual blog entries aren't made unique in the main page
3 participants