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

Adding anchors to all sections on pages #497

Closed
parispittman opened this issue Jan 25, 2024 · 4 comments
Closed

Adding anchors to all sections on pages #497

parispittman opened this issue Jan 25, 2024 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@parispittman
Copy link
Collaborator

Is your feature request related to a problem? Please describe

When going to https://www.swift.org/community/, I'd like to copy the anchor to the page section for an easy copy and paste. I know that I can add "#" to the url for the major sections (example: swift.org/community/#communication) but it would be nice to have the link icon next to the sections at scroll over.

I'd like if the sub-sections were treated the same and they don't have an anchor right now at all.
Example: I find myself having to point to the Core Team's contact us on the forums link a good amount recently. It would be great if there is an anchor that would point directly to the Core Team section.

Describe the solution you'd like

Anchor links for sections and subsections alike next to the titles for easy copy and pasting.

@parispittman parispittman added the enhancement New feature or request label Jan 25, 2024
@ishaanbedi
Copy link
Contributor

Hey!
I was able to get a working solution for this issue, as demonstrated in the following video:

Screen.Recording.2024-01-30.at.1.24.37.PM.mov

I used this repo to add anchors to the headings. It could have been done using javascript itself from scratch, but using this repo seemed to be an easy way to implement anchors site-wide without changing a lot of things, and it works even with javascript disabled in the browser. I am not sure whether it'd be fine to include a third-party package, though it is MIT-licensed. Still, I'd like to hear your thoughts on this.

Here's a link to my fork to test it out: https://sow-ib.vercel.app/community

cc @alexandersandberg

@federicobucchi federicobucchi self-assigned this Feb 4, 2024
@alexandersandberg
Copy link
Collaborator

Thanks for giving this a go, @ishaanbedi!

I think it would be nice to only show these anchors when the heading is hovered or focused. What do you think?

@ishaanbedi
Copy link
Contributor

Hi @alexandersandberg !

I think it would be nice to only show these anchors when the heading is hovered or focused. What do you think?

That does sound better.

After a bit of changes and modifications to code, I was able to implement it:

Screen.Recording.2024-02-06.at.8.25.31.AM.mov

Here's a link to my fork to test it out: https://sow-ib.vercel.app/contributing

@alexandersandberg
Copy link
Collaborator

This looks great! Feel free to open a PR and we can continue to discuss it there. 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants