Open matthewandrews opened 3 years ago
Right now the media JSON is not available; this requires a change to the ALA home publish process (see https://github.com/AtlasOfLivingAustralia/ala-infrastructure/issues/814 ).
Actually the process will be a bit different; the media_details
/ sizes
element will probably become part of recentposts.json
.
@alexhuang091 this should be fairly quick to fix... if you're doing work on Alerts
The href links in ws:featureMedia link in https://www.ala.org.au/recentposts.json return 404
(ALA-specific issue, relating to the Blogs and News email template). There is no longer a direct URL to a featured image thumbnail in the JSON file parsed by the Blogs and News query (test example: https://www-test.ala.org.au/recentposts.json )
We now have, for each post, an element
_links
which contains an arraywp:featuredmedia
. We need the first item ofwp:featuredmedia
, which will have an elementhref
. This will be a URL of the form https://www-test.ala.org.au/wp-json/wp/v2/media/43624 - note that this is NOT the URL of the image: this will return a JSON response.In this media JSON, the
media_details
element contains asizes
element. This contains various elements for different image sizes: we want thethumbnail
element. This contains three elements which would be useful to parse and make available to the blog template:file
(URL of the actual thumbnail image),width
(int), andheight
(int).The
alt_text
element at the top level of the media JSON should also be made available.The blog template will need to be modified to use these new values.