Allow Arbitrary Homepage (by Jay Pfaffman)

Well, @hellekin thought that this deserved its own topic. I’m not quite sure it’s ready for such, but here it is. I’ll have a look at stuff early next week and try to make sure that it looks like something that other people could really use. :wink:

As he said:


@pfaffman I tried to use the following setup:

  1. install your theme component
  2. set home_url_override to TransHack ·Xist·nce…
  3. add some Nginx configuration to match the HTML file:
        location = /TransHack_·Xist·nce… {
                default_type text/html;
                alias /srv/www/;

Calling the file directly works, but calling breaks. As I noticed a check on permalinks, I tried to add a permalink for /. But it did not work either. Might this be an issue with cache?

FYI, here is the content of the home.html file:

<!DOCTYPE html>
                <meta charset="UTF-8">
                <title> TransHack ·Xist·nce… </title>
                <link rel="stylesheet" href="/thx.css">
        <body class="thx home">
                <section id="agora">
                        <h2><a href="">Agora</a></h2>
                        <d-topics-list discourse-url="" per-page="5" category="1"></d-topics-list>
                <section id="fonderie-de-fiction">
                        <h2><a href="">Fonderie de fiction</a></h2>
                        <d-topics-list discourse-url="" per-page="5" category="7"></d-topics-list>
                <script src=""></script>

Edit: I guess it might be due to the fact the instance requires login (SSO), then there’s a dysfunction in this case. I might be willing to make more tests including opening the instance a bit more. After rendering the site public, I still get " Oops! That page doesn’t exist or is private." when hitting the homepage. Any idea why?


Is the home page you’re setting on your discourse site? I think you want to put just the url starting with the /.


Oh, so the file should be the default – usually index.html?

Indeed it works! The component expects the URL to be an index file, right?

I simply had to rename my home.html to index.html and change the Nginx configuration to:

        # more config...
        root   /srv/www/;
        index  index.html; # <- this is important

        location = /TransHack_·Xist·nce… {
                default_type text/html;
                alias /srv/www/; # <- and matches
        location / {
                # nginx magic to try the local file before proxying...
                try_files $uri $uri/ $uri.html @discourse;
        location @discourse {
                # normal discourse proxy

So, to summarize…

If you’re using a static page on the same site as the Discourse instance, make sure your Web server reads the static file(s) – e.g., related CSS – before proxying the requests to the Discourse. Tadaa!

Thank you @pfaffman!


Actually a bug remains: although calling the URL works from outside, once in the Discourse, clicking the logo does not result in bringing back the overridden page. I noticed a permalink check, so I tried several options, which all failed:

  1. create a permalink from to /index.html
  2. create a permalink from to /TransHack_·Xist·nce…
  3. combine those with a permalink from /index.html to /TransHack_·Xist·nce…
  4. remove the redirect to /TransHack_·Xist·nce… in the frontend configuration
  5. create a custom_url permalink and point it to an external URL

I guess the issue comes from the fact the script does not try to reload the whole application when clicking on the logo but expects an internal link to be attached to the top path.

I would expect that when either the homepage_url_override or the (e.g., custom_url) permalink points to an absolute URL, then the page is fully reloaded.