Skip to content

Conversation

theletterf
Copy link
Contributor

Fixes #1759

  • Turns the existing and inherited :name: parameter into an anchor link for the dropdown title.
  • Updates the docs with examples.

I avoided adding a visual indicator because it would have polluted the design of the dropdown.

LLM Disclosure: All the commits in this PR were co-authored by Copilot Enterprise using Claude Sonnet 4

Copy link

github-actions bot commented Aug 22, 2025

🔍 Preview links for changed docs

Copy link

@wajihaparvez wajihaparvez left a comment

Choose a reason for hiding this comment

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

Thank you! 🎉

@theletterf
Copy link
Contributor Author

@elastic/docs-engineering PTAL, thanks!

Copy link
Member

@Mpdreamz Mpdreamz left a comment

Choose a reason for hiding this comment

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

Do we want to always ensure we can deeplink to dropdowns?

E.g infer :name: if none is provided?

@theletterf
Copy link
Contributor Author

@Mpdreamz Used the slug class to generate names for dropdowns automatically. Had to add some extra logic to handle dropdowns with :open: because they were triggering the URL update (and we don't want that).

@theletterf theletterf requested a review from Mpdreamz August 27, 2025 13:52
Co-authored-by: Martijn Laarman <Mpdreamz@gmail.com>
@theletterf
Copy link
Contributor Author

@Mpdreamz Seems like we've hundreds of duplicated dropdown names. I'm in favour of not generating anchors automatically at this point. :) https://github.com/elastic/docs-builder/actions/runs/17273537579/job/49024386232?pr=1765

@Mpdreamz
Copy link
Member

I do think its best if this works uniformly across all drop-down, we might need to create a docs-content issue to address the duplicates on a single page which may hurt SEO too.

@theletterf
Copy link
Contributor Author

@Mpdreamz So unless we turn the errors into Hints, this PR will be blocked until we make all the dropdown titles unique?

@Mpdreamz
Copy link
Member

I think we need a plan, just merging it with hints is not sufficient as hints are too easily ignored and will create PR annotations

Since it effects our links.json generation I want to take extra care as well.

@theletterf
Copy link
Contributor Author

The only other option I'm thinking of is to just allow manual naming / anchoring and not generating anchors automatically. Then in a second phase we could sweep through docs sets as part of SEO improvements and add autogeneration.

@Mpdreamz
Copy link
Member

I think its best to identify all places tackle them and then merge this.

The other way around creates no pressure on actually addressing the issue :) We can create a tracking issue in docs-content to look in to all occurrances.

Will do so next week!

@theletterf theletterf mentioned this pull request Sep 1, 2025
3 tasks
@theletterf
Copy link
Contributor Author

Not sure how to proceed with this one. Couldn't we just remove the automatic generation of anchors?

@theletterf
Copy link
Contributor Author

theletterf commented Oct 2, 2025

@Mpdreamz This now works as intended in that it automatically generates an anchor for each dropdown if one isn't set.

I also added an Hint for duplicated anchors of any type (heading and dropdowns) and the assembled quantity is staggering: more than 4k duplicated anchors, if the method is correct.

Since dropdown anchors do not interfere with the ToC, which is the biggest source of confusion for users, I would suggest that we move the Hint / detection logic to a separate PR and just merge this one.

@theletterf theletterf removed the blocked label Oct 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request]: Enable linking to dropdowns
3 participants