Feature #14256
closedDesign/UX #13998: Homepage Redesign
"Latest News" feed
0%
Description
The Latest News section of the homepage redesign should include the latest three posts collectively from:
https://news.commons.gc.cuny.edu
https://in.commons.gc.cuny.edu/
Updated by Boone Gorges about 3 years ago
- Status changed from New to Testing Required
Here's background on how this is built:
- The list of sites that are the source for Latest News is defined here https://github.com/cuny-academic-commons/cac/blob/f3158f150819ff9c7ae901c07dc4ba4b215ac0e6/wp-content/mu-plugins/cac-functions.php#L341
- On the home page, the latest items from these source sites is pulled using the WP REST API. See https://github.com/cuny-academic-commons/cac/blob/f3158f150819ff9c7ae901c07dc4ba4b215ac0e6/wp-content/themes/bp-nelo/parts/home/latest-news.php#L3. I tried doing this with switch_to_blog()
, but that function isn't sufficient - things like fetching post thumbnails failed because of limitations in blog-switching and persistent caching. I made a modification to the /posts/ endpoint on the source sites so that the post thumbnail is included in the payload https://github.com/cuny-academic-commons/cac/blob/f3158f150819ff9c7ae901c07dc4ba4b215ac0e6/wp-content/mu-plugins/cac-functions.php#L366
- Because we are using Featured Images, it's critical that items on in.commons and news.commons always have Featured Images. Scott, I've added you as a watcher so that this can become part of the team workflow.
- The API calls are cached, and the cache is invalidated when a new post appears on one of the source sites. https://github.com/cuny-academic-commons/cac/blob/f3158f150819ff9c7ae901c07dc4ba4b215ac0e6/wp-content/mu-plugins/cac-functions.php#L353
Updated by Boone Gorges about 3 years ago
Quick follow-up: The REST API mods were necessary for development testing, so I had to deploy them prematurely to the production site. So they can be found in the 1.18.x branch.
Updated by Boone Gorges almost 3 years ago
- Status changed from Testing Required to Staged for Production Release
Updated by Boone Gorges almost 3 years ago
- Status changed from Staged for Production Release to Resolved