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.

image

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

3 Likes

Interested on this if anyone has an update!
@Drew-ART

I have a reference from Zendesk that would be awesome to.

We’re hoping that the the navigation sidebar makes the UX easy enough that the double search bars aren’t needed, so i’ve removed them and we’ve stopped working on this.

There are plenty of existing plugins which you can use to put a search bar like that on your homepage though if that’s all you want to do.