Explainers, Q & As, etc

54 views
Skip to first unread message

Phil Gyford

unread,
Mar 29, 2018, 11:55:01 AM3/29/18
to Guardian Open Platform API Forum
When fetching the `body` element for an article via the API, the text contains HTML for the various kinds of 'boxes' often found within articles - "explainers", "Q&A", etc. But the versions that come from the API seem a little broken...

Most of the time they're just missing the title of the box. For example, this article has a Q&A in an expandable box: https://www.theguardian.com/society/2018/mar/28/parole-board-chair-sacrificial-lamb-nick-hardwick Here's a screenshot of it expanded:



<figure class="element element-atom">
  <gu-atom data-atom-id="d409e35f-d4a3-4fbe-a5ac-3437180b5660" data-atom-type="qanda">
    <div> 
      <div class="atom-Qanda">
        <p></p>
        <p>The Parole Board is an independent body ... </p>

        [ More paragraphs here ... ]

        <p> ... staff to support them.</p>
        <p></p>
      </div>
    </div>
  </gu-atom>
</figure>

A worse example is the "Explainer" on this page https://www.theguardian.com/media/2018/mar/28/julian-assange-internet-connection-ecuador-embassy-cut-off-wikileaks seen here:


When this is fetched from the API using http://content.guardianapis.com/media/2018/mar/28/julian-assange-internet-connection-ecuador-embassy-cut-off-wikileaks?show-fields=all&api-key=test then the box is include but contains no content at all:

<figure class="element element-atom">
  <gu-atom data-atom-id="19e4c3a8-0a8d-4710-ad8e-9ee37c06c41a" data-atom-type="explainer">
    <div>
      <div class="atom-Explainer"></div>
    </div>
  </gu-atom>
</figure>

 
It think the title in the first example, and the entire content in the second, are filled in using JavaScript on the Guardian's site. It seems odd to have these incomplete elements returned in the data from the API - they're either slightly confusing (no title) or entirely useless, and seem broken.

Is there some option I've missed in the API which would return more complete boxes, or is there something broken with the API's generation of these boxes, or is this just how things are and the API's going to be a little broken from now on?

Thanks,
Phil Gyford



Nicolas Long

unread,
Mar 29, 2018, 12:01:54 PM3/29/18
to guardian...@googlegroups.com
Hey Phil,

I don't know the specific answer to this question - though I'm sure someone from the API team will respond shortly. But wanted to say great work on your The Guardian Today site - remember seeing quite a few years ago, before I started working here, and being really impressed! Glad to see it still exists.

Nic

--
You received this message because you are subscribed to the Google Groups "Guardian Open Platform API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to guardian-api-talk+unsubscribe@googlegroups.com.
To post to this group, send email to guardian-api-talk@googlegroups.com.
Visit this group at https://groups.google.com/group/guardian-api-talk.
For more options, visit https://groups.google.com/d/optout.



--

Nic Long

Recovering Developer Manager - Dotcom Team

Guardian news & media

nicola...@theguardian.com



This e-mail and all attachments are confidential and may also be privileged. If you are not the named recipient, please notify the sender and delete the e-mail and all attachments immediately. Do not disclose the contents to another person. You may not use the information for any purpose, or store, or copy, it in any way.  Guardian News & Media Limited is not liable for any computer viruses or other material transmitted with or as part of this e-mail. You should employ virus checking software.
 
Guardian News & Media Limited is a member of Guardian Media Group plc. Registered Office: PO Box 68164, Kings Place, 90 York Way, London, N1P 2AP.  Registered in England Number 908396


Phil Gyford

unread,
Mar 31, 2018, 10:40:51 AM3/31/18
to Guardian Open Platform API Forum
Thanks Nic. I've been trying to update a couple of things on the site, including displaying these boxes more reliably... hence the question :)


To unsubscribe from this group and stop receiving emails from it, send an email to guardian-api-t...@googlegroups.com.
To post to this group, send email to guardian...@googlegroups.com.



--

Nic Long

Recovering Developer Manager - Dotcom Team

Guardian news & media

nicola...@theguardian.com

Phil Gyford

unread,
Apr 2, 2018, 12:46:12 PM4/2/18
to Guardian Open Platform API Forum
On Thursday, March 29, 2018 at 4:55:01 PM UTC+1, Phil Gyford wrote:

It think the title in the first example, and the entire content in the second, are filled in using JavaScript on the Guardian's site. It seems odd to have these incomplete elements returned in the data from the API - they're either slightly confusing (no title) or entirely useless, and seem broken.

 I've just noticed that in this second example the content is there in the HTML on the website (it's not created by JavaScript); it's simply styled using JS. But the content's still missing from the API version of the article.

Phil

regis.k...@guardian.co.uk

unread,
Apr 4, 2018, 11:57:13 AM4/4/18
to Guardian Open Platform API Forum
Hi Phil

These gu-atom elements are placeholders that are replaced with the HTML you see on the site as a form of progressive enhancement, the HTML inside is some default rendering we actually never use. The reason is we might want to display atoms differently depending on local criteria, e.g. in article vs liveblog, in web vs app. Admittedly, the default rendering could be improved slightly, as in the explainer example.

The actual rendering you see is produced by an open source library of ours (https://github.com/guardian/atom-renderer/), e.g. inside articles we use ArticleAtomRenderer. You can see how the whole process unfolds here:

We'll try to squeeze some time to work on that default rendering; in the meantime I hope the above can be useful to you. Let me know if you have any more question.

Regis

Phil Gyford

unread,
Apr 13, 2018, 9:53:16 AM4/13/18
to Guardian Open Platform API Forum
Belated thanks Regis. All understood.

It'd seem sensible if the default HTML returned from the API was useful and meaningful as-is (e.g. has titles for those blocks, and there are no empty blocks) but I realise you all have many competing demands on your time!

Phil
Reply all
Reply to author
Forward
0 new messages