1. 21
    Manage Media Assets in a Headless WordPress Site using the Cloudinary WordPress Plugin
    1m 50s

Manage Media Assets in a Headless WordPress Site using the Cloudinary WordPress Plugin

Share this video with your friends

Send Tweet

There are two approaches to dealing with an extensive media library when using a Headless WordPress solution. The first is that during the build step, the assets are queried and downloaded to a static folder that's served using a CDN. The second approach is that you use a third-party solution like Cloudinary to host your images.

In this lesson, we will use the Cloudinary WordPress plugin to migrate all images from our existing posts to Cloudinary. This approach provides the benefit of managing the assets directly on the WordPress interface and using Cloudinary to serve them.

Next steps for you to try:

  • Add additional data via WordPress Plugins
  • Build a frontend for your data with Gatsby or Next.js
fab Cor
fab Cor
~ 4 years ago

Great course !Would be interesting to see how you managed internal links (for example a wordpress post that makes a link to another post). Within wordpress, that is correct, but how yo you make the link work on a detached front-end that will be on another domain ?

Kevin Cunningham
Kevin Cunninghaminstructor
~ 4 years ago

Hey Fab! Thanks for the question.

I think this really depends on your frontend solution. Both the Gatsby plugin (gatsby-plugin-wordpress) and the NextJS starters that I've seen have capability to detect and transform these links. Handling it on the clientside means that if you have custom routing logic you can apply it there.

In the headless data layer, I suggest leaving the links as they are rendered. That way they will match what your client layer is expecting.

Hope that helps!

fab Cor
fab Cor
~ 4 years ago

Thank you for your response. Till now, I haven't used any react based static site generators like Gastby or Next. I like Nuxt (vue.js) or simply Eleventy. You suggest to leave those links as they are and to modify them as needed in the front-end code through parsing the url, correct ? But what do you think of having relative links in wordpress (using for example https://fr.wordpress.org/plugins/make-paths-relative/) ? Is it a good idea or is it just more pbls for later ?

Kevin Cunningham
Kevin Cunninghaminstructor
~ 4 years ago

You'll know your use-case better than me but to me it would feel like you are making things potentially problematic.

A link in WP to /my-great-post might actually be to /posts/my-great-post on the front end. I feel like transforming all the links in the presentation layer, using a middleware in Nuxt or similar, would make more sense - especially as you handling routing for your application here.

But, as always, your mileage may vary :)

fab Cor
fab Cor
~ 4 years ago

Ok thank you.

~ 3 years ago

It'd be nice to have how to fetch menus :)

Kevin Cunningham
Kevin Cunninghaminstructor
~ 3 years ago

Great shout! I'll add it to a list of enhancements. Thanks!