Closed JamieB-gu closed 5 months ago
DCAR should defo get access to much betterer bylineHtml
. But not sure everything can be 100% sorted (?):
[URL]
Central Production will be helpful (as always!) in knowing about and finding all the possible values for that field… In short, there is no such thing as “Byline Job Title”.
An example of a byline with two contributors: https://www.theguardian.com/uk-news/2024/apr/03/levelling-up-what-has-the-government-spent-and-where
I think the data model we get from CAPI (even if we pass the Byline HTML field to DCR) doesn't support a full solution to this issue, because any solution just exposes a different edge case. Given this is fairly low impact I'm inclined to close it.
The variants of byline/contributor combinations I've discovered are:
<a>A Name</a>
)<a>A Name</a> Health and wellness correspondent
)<a>A Name</a> and <a>Another Name</a>
)<a>A Name</a> and Another Name
)A Name
)A Name and Another Name
)A Name Health and wellness correspondent
On analysis articles, if the piece only has a single contributor, the byline is meant to include the name of the author on one line and the job title (if present) on another. However, in some cases they're both appearing on the same line, one after another.
Why?
The styles that wrap the job title onto a new line can be found here:
https://github.com/guardian/dotcom-rendering/blob/9905ceb642bb20c2c6c21c92129e269c46fd994f/dotcom-rendering/src/components/HeadlineByline.tsx#L104-L107
and are applied here only if the piece has a single contributor:
https://github.com/guardian/dotcom-rendering/blob/9905ceb642bb20c2c6c21c92129e269c46fd994f/dotcom-rendering/src/components/HeadlineByline.tsx#L208-L209
However, the current logic says a piece only has a single contributor if the byline does not include the word "and":
https://github.com/guardian/dotcom-rendering/blob/9905ceb642bb20c2c6c21c92129e269c46fd994f/dotcom-rendering/src/lib/byline.ts#L16-L19
The examples above have the word "and" in the job title:
so this logic assumes there's more than one contributor, the additional styles do not get applied, and the name and job title appear on the same line.
Possible Solution
AR doesn't suffer from the same problem because it uses CAPI's
bylineHtml
field, which tends to separate the different parts of the byline into different elements.https://github.com/guardian/dotcom-rendering/blob/9905ceb642bb20c2c6c21c92129e269c46fd994f/apps-rendering/src/components/Byline/Byline.defaults.tsx#L83-L87
DCR doesn't currently have access to this version of the byline because it's not passed through from
frontend
. One option would be to update the frontend models to include this and use it instead.