Home > Software design >  Best way to share content between a Wordpress site and a Drupal site
Best way to share content between a Wordpress site and a Drupal site

Time:09-23

I will try to be clear but if you need more information please do not hesitate.

A site approached me to make a partnership together. They want to create a new section on their site, say a "blog" section. The goal is to post my blog post on their site, in this new section, without having access to their admin.

So I need to set up something to be able to automatically share the content I post on my site with their site. My site is on Wordpress and their site is on Drupal.

For now I see 2 possibilities, but tell me what you think and if there is better to do.

  • First possibility: Create the page /blog and all the articles (ex: /blog/article-title) on my site, then set up a reverse proxy to redirect their request to my server. I have no experience with network setup so maybe I am completely wrong. But even if it works, I don't know how to fetch only post content (not header, footer) and change all urls.

  • Second possibility: Create a Drupal module, which they will have to install on their site, which creates the page /blog and the custom content type named "blog" when it is activated. And then use the feeds module to get the content from my wordpress feed and create a blog post for each post in the feed. With this solution, I won't have any header or footer problem, and the urls to the articles will be generated dynamically.

Every advice will be usefull. Thank you.

CodePudding user response:

IMO, the easiest way to do that is to use the Wordpress REST API.

You could get all posts with this https://yoursite.com/wp-json/wp/v2/posts and get a specific post with https://yoursite.com/wp-json/wp/v2/posts/:id

full doc here : https://developer.wordpress.org/rest-api/reference/

CodePudding user response:

I would advise you to use the second possibility, cause there are already several drupal moduls in the wild the read and import feeds from other sites.

Even more, WordPress will provide your posts also in oembed-format. With this you can use this Drupal Modul: https://www.drupal.org/project/soembed

You vcan adjust this modul to allow content from your website and display it on the Drupal installation.

  • Related