Closed Bug 1353794 Opened 7 years ago Closed 7 years ago

Add image and category items to BlogArticle helper

Categories

(www.mozilla.org :: Pages & Content, enhancement)

Production
enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: agibson, Assigned: pmac)

Details

For the creation of the new Firefox content hub pages, we're going to need a few new features added to the BlogArticle helper [1]

1.) We'd like to pull in a thumbnail image for each article (image URL)
2.) We'd like to pull in tags (categories) for each article
3.) We'd like to be able to display (x) articles based on (y) tag

For reference, a rough prototype of a hub page in question that would use this can be seen here (blogs section toward the bottom):

https://bedrock-demo-agibson.us-west.moz.works/en-US/firefox/features/

[1] https://github.com/mozilla/bedrock/blob/master/bedrock/mozorg/models.py#L100
I think the best way to do this is to change how we consume our blogs. All of our blogs are run on a recent enough version of Wordpress that they all include v2 of the JSON API[0]. This will give us everything we want including tags, categories, and featured media.

For the images I recommend we store the URL and simply hotlink to the image hosted on our blog. "*.mozilla.org" is already whitelisted in our CSP for images, so we can load images from blog.mozilla.org. This will be quick and easy to implement, and if we need to later we can improve things so that they're pulled in and processed. But Wordpress provides several sizes of each image via the API[1].

With all of the data from the API I can easily provide simple tools for filtering via tags and/or categories as well as getting a post thumbnail URL.

[0] https://developer.wordpress.org/rest-api/
[1] https://blog.mozilla.org/firefox/wp-json/wp/v2/media/45
Assignee: nobody → pmac
Status: NEW → ASSIGNED
Commits pushed to master at https://github.com/mozilla/bedrock

https://github.com/mozilla/bedrock/commit/cc22741d907ada0126c763c4e5e413bce6d1c5f8
Bug 1353794: Add app to consume and store wordpress data

Fetches wordpress data via the JSON API. Fetches tags and
featured media if present as well.

Also add blog post generic view and QS methods to filter by blog and/or tags easily.

https://github.com/mozilla/bedrock/commit/38f805f4f04ccdc24803a3c2248904a1f9e561bc
Merge pull request #4757 from pmac/better-wordpress-1353794

Bug 1353794: Add app to consume and store wordpress data
Marking this as fixed, as what we have now seems to meet our current needs well. Thanks pmac!
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.