I want to use the Discourse search bar from an external site so users arrive at the search page in my forum

Looking for advice on how to go about this task.

We have a landing page for our site built in Reactjs and our Discourse forum is one half of the total platform. I want users to be able to search the forums from that landing page so they can go directly to where they want.

We actually load the Reactjs landing page inside of our Discourse (for unrelated reasons), so Discourse is open in the same window and the search function is in the header, but we want to pull it into the Reactjs page.


These are the three options i’ve begun exploring:

  • As Discourse is already open i was thinking perhaps its possible to simply mirror whatever is typed into that search bar into Discourse’s search function.

  • Perhaps its easier to send the search call to Discourse via API

  • Discourse uses url’s in a very clear and open manner. Would it be simpler to just create a new function which searches by navigating to the search url? For example https://mysite.com/search?q=teletubbies%20happiness

If you were tackling this task which one of those would you try, or something totally different?

Thank you for your advice