Skip to content

resolveContentLink takes the label from the wrong node for a link mixin #770

Description

@romain-pm

Part of #749. resolveContentLink derives the label from the wrong node when the link is a mixin.

Its precedence is jcr:title on the content node, then j:linkTitle, then the target's displayable name. That is right when the link is the content (jnt:nodeLink). It is wrong when the link is a mixin on something else: Jahia/jahia.com's jahiacommix:cta sits on a card, a panel or a hero that already has a jcr:title — the heading, not the link label. So the API returns the heading.

This cost the largest single win available on that site: the CTA mixin is 23 call sites, and all of them had to keep getLinkProps plus the discriminator ternary.

  • labelProperties?: readonly string[] to state where the label lives.
  • And/or labelFrom: "content" | "target".
  • Say in the guide which one a mixin-shaped link wants, since that is the common case in a real project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featA new feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions