-
Notifications
You must be signed in to change notification settings - Fork 36
Description
The on-hover "Link to Keywords" element is a broken link since the anchor #keywords does not exist. Compare the broken implementation of Keywords.tsx:
myst-theme/packages/site/src/components/Keywords.tsx
Lines 15 to 28 in 939ad37
| <div className={classNames('mb-10 group', className)}> | |
| <span className="mr-2 font-semibold">Keywords:</span> | |
| {keywords.map((k, i) => ( | |
| <span | |
| key={k} | |
| className={classNames({ | |
| "after:content-[','] after:mr-1": i < keywords.length - 1, | |
| })} | |
| > | |
| {k} | |
| </span> | |
| ))} | |
| <HashLink id="keywords" title="Link to Keywords" hover className="ml-2" /> | |
| </div> |
To the working implementation of Abstract.tsx:
myst-theme/packages/site/src/components/Abstract.tsx
Lines 17 to 25 in 939ad37
| <div className={className}> | |
| <h2 id={id} className="mb-3 text-base font-semibold group"> | |
| {title} | |
| <HashLink id={id} title={`Link to ${title}`} hover className="ml-2" /> | |
| </h2> | |
| <div className="px-6 py-1 mb-3 rounded-sm bg-slate-50 dark:bg-slate-800"> | |
| <MyST ast={content} className="col-body" /> | |
| </div> | |
| </div> |
Line 18 of Abstract.tsx defines the id for the h2, which provides the destination for the HashLink. This is missing from Keywords.tsx
While we could easily add an id to the Keywords.tsx span, how important is the "Keywords" link? Unlike the abstract, the keywords aren't given a specific heading level so I'm wary of just adding the id.
I suggest removing the HashLink in Keywords.tsx. If this sounds good, I can submit a pull request.