feat: Add target attribute to links in listing templates if provided#12293
feat: Add target attribute to links in listing templates if provided#12293mcanouil wants to merge 13 commits intoquarto-dev:mainfrom
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
cderv
left a comment
There was a problem hiding this comment.
Thanks for the addition.
If I see the value of the feature, I am wondering if this is best field name. target is a bit broad when you don't know about the usage.
And it opens also question for other link attribute. For example, with target="_blank" you usually want to add rel="noopener noreferrer" for security.
It fiels a bit weird to have such fields that controls listing links rededring at top level.
But that is just first impression here. I am thinking about better organization or naming.
For example, what if need to allow aria-label addition for those link ? if it should be controlled by user, it would be another field ?
I wonder if we should have something closer to manuscript code-links
https://quarto.org/docs/manuscripts/components.html#code-links
listing-link:
target: "_blank"
rel: "noopener noreferrer"
aria-label: "Opens in new window"
This would allow adding schema maybe.
Also, doc related: this is kind of a special metadata field that needs to go into the list of known ones
https://quarto.org/docs/websites/website-listings.html#listing-fields
I think it is good to always have doc in mind which each PR.
This is the kind of PR that seems simple to fix, but requires some thinking for best long term behavior.
Regarding code review, you need to be thorough. I believe if you add a field to template you need to update that part too
Otherwise the field will end up in a metadata-value div, which I don't think we want here right ?
Anyhow, open to discussion.
|
You're right that |
This PR is one year old and as you pointed needs a bit of discussion to generalise it (also why I initially added the label). Few notes:
|
Yes, that is why sometimes a feature that seems nice and easy to do can lead to more design question, and more thoughts needed. Generally why contributed feature PR takes time to review and think about. |
Enhance the listing templates by conditionally adding a target attribute to links.
This allows for better control over link behaviour, enabling users to open links in new tabs if specified.
Screen.Recording.2025-03-14.at.21.43.08.mov
Originally discussed in: