Hosting dynamic pages with discourse

AI-generated summary

The discussion is about hosting dynamic pages with Discourse. MihirR wants to create a separate folder on the same domain to host dynamic pages, such as PHP files, while keeping Discourse on the main domain. pfaffman explains that Discourse doesn’t use PHP, but plugins can achieve similar functionality. Jagster suggests using a reverse proxy or Varnish to redirect calls to a separate backend, such as LAMP, for dynamic pages.

Merefield points out that the Landing Page Plugin has a Home Pages extension that allows for dynamic pages. MihirR decides to try the plugin and later installs it, thanking merefield.

MihirR reveals that the interactive page is intended to handle API queries, mainly from Crunchbase, and asks if it’s possible to run HTML, CSS, and JS using the Landing Page Plugin. pfaffman provides resources on developing Discourse plugins. merefield advises keeping API keys secure by using a plugin, rather than the Home Pages extension, which is a front-end extension. MihirR confirms that the plugin works and is looking into keeping API keys safe using a .env file.

Is there a way to host dynamic pages with Discourse? I looked into the Landing Page Plugin, but it’s for static pages. I don’t mind having Discourse on the main domain itself instead of a subfolder, although I know I can build dynamic pages in subfolders then. Is there any alternative or a way to do this by keep Discourse in the main dir itself and adding dynamic pages to a folder?

What I mean is, I’m on the domain www.example.com, which has Discourse running on it. Can I create a separate folder on the same domain where I can host dynamic pages, like www.example.com/dynamic-folder/index.php?

Discourse doesn’t use php, so you can’t host php files with discourse.

You can do anything that php can do with a plugin, however. It’s very different than php, though.

As i red the question is can a directory, as part of an url, be outside Discourse or Docker (docker is very difficult consept to understand for me) and therefor use PHP.

Or — can, for example, a reverse proxy redirect calls so that directory part is taken care by something like LAMP, and everything else goes to Discourse. Then it is only matter of two backends, right?

Actually I’m quite sure, in theory anyway, that could be made using Varnish. What I don’t know, among really many things, what kind of conflict will happen if/when that url is called inside Discourse. Or is it even then only matter of redirects.

However — that question is off topic in this category, because solution would be something else than standard.

That’s not true, it has the Home Pages extension which allows for dynamic pages.

Okay, need to give it a shot then :))

Actually, I guess I should give it a try on a dummy community first to check if it works fine and doesn’t cause any issues or conflicts.

What is it that you need your interactive page to do?

It was supposed to handle some API queries mainly :))

Thanks @merefield, I have installed the plugin and will update you asap.

So these api inquiries have to do with data in discourse? Can you be more specific.

Not really, it’s more like a custom feature I’d like to add. It doesn’t have anything to do with Discourse, t’s more of a custom PHP page where I can fetch data using an API mostly intended from Crunchbase and make some processes work.

Also, is it possible to run HTML CSS JS here? Maybe using the landing page plugin itself or through some other method?

See Developing Discourse Plugins - Part 1 - Create a basic plugin Theme Developer Quick Reference Guide

Yeah, if you are accessing remote data, which might require API keys, do that in a Plugin so the API keys can be kept secure and private and used only in the back-end.

Home pages is purely a front-end extension.

Yes, that’s the reason I was actually asking if we can add a folder to keep the key safe in a .env file. Also, I tested the plugin, it works great thank you! :))