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

Add autoID for definition terms #13404

Merged
merged 1 commit into from
Feb 16, 2025
Merged

Add autoID for definition terms #13404

merged 1 commit into from
Feb 16, 2025

Conversation

bep
Copy link
Member

@bep bep commented Feb 16, 2025

Fixes #13403

@bep bep force-pushed the feat/dlautoid branch 5 times, most recently from fcfaa8f to 0a6878f Compare February 16, 2025 15:17
@bep bep marked this pull request as ready for review February 16, 2025 15:18
@bep bep changed the title Add autoID for decription terms Add autoID for description terms Feb 16, 2025
@bep bep changed the title Add autoID for description terms Add autoID for definition terms Feb 16, 2025
@bep bep force-pushed the feat/dlautoid branch 3 times, most recently from 2a6d797 to 412bdd6 Compare February 16, 2025 17:11
@bep bep requested a review from jmooring February 16, 2025 17:46
Copy link
Member

@jmooring jmooring left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll take this for a spin in a bit.

@jmooring
Copy link
Member

Something to think about for the docs site... since we don't have a dt render hook, should we use something like https://github.com/bryanbraun/anchorjs to render anchors for both headings and dt elements?

@bep
Copy link
Member Author

bep commented Feb 16, 2025

should we use something like https://github.com/bryanbraun/anchorjs to render anchors for both headings and dt elements?

No. If we want to do this via JS it can be easily be done in "five lines" in a AlpineJS controller.

@jmooring
Copy link
Member

This is very slick. Works great with the link render hook on the docs site (e.g., validate id existence and check for duplicates).

And thanks for this too:

A [link](/a/b) in the heading --> id becomes "a-link-in-the-heading"
: something

@jmooring
Copy link
Member

If we want to do this via JS

I have no preference how we do it... this is the last task in eliminating the h6 hack.

@bep
Copy link
Member Author

bep commented Feb 16, 2025

I have no preference how we do it... this is the last task in eliminating the h6 hack.

I added a fix for this in gohugoio/hugoDocs#2914

I like definition lists for documentation and making them as easy to use as possible (by making them easy to link to) is worth it, I guess, so I suggest we go with the approach above. It's simple enough.

@bep bep merged commit 157d370 into gohugoio:master Feb 16, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add autoID for definition terms
2 participants