ProCourse Static Pages

Thanks Steven; from a bit of a play it isn’t possible to make them visible to anon on login-required forums. Rats - that is what I really want them for. Still pretty cool though.

It seems that the only way I can get more static content visible to non-logged in users is to either

  1. keep it login-required and use the existing tools:
    • /admin/customize/site_texts/login_required.welcome_message
    • /tos
    • /privacy
      or
  2. make the forum so that it isn’t login-required (ie public)
    • and tightly control the visibility of each category and group
    • get the full /tos, /privacy, /about, /faq suite
    • make as many static pages as I like via enable page publishing

Does anyone know another way (apart from pages hosted on another domain / subdomain) of achieving this?

4 Likes

Full instructions at Page Publishing

1 Like

This. I know that this plugin is primarily to create static pages. However, let’s say you make a calculator application that you want to put in the page. The calculator requires an input from the user. The page still has static code, but it would update the result based on user input. Is this possible using this plugin or is it better just to make an external html/css page with js?

1 Like

I would like to use a 3rd party widget on a static page. The javascript for this is supposed to be inserted before </body>. Is there a way to achieve this – only on this particular static page? Thanks for your help!

Just sharing how I achieved running a script for the static pages:

<script type="text/discourse-plugin" version="0.8">
    const { setDefaultHomepage } = require('discourse/lib/utilities');
    const user = api.getCurrentUser();
    if(!user) {
        setDefaultHomepage('/page/welcome/1/'); // <--- set homepage url
    }
    api.onPageChange((url, title) => {
        if(url.indexOf("/page/welcome") === 0) {
            // do stuff for this static page
        }
    });
</script>

Just a clarification: setting the page as homepage is totally optional when it comes to running the script, I wanted to show it can be done as well :+1:

3 Likes

Thanks!
Do you know a wat to use external scripts (not from the same domain) for the static page?
There is always
Content Security Policy: The page’s settings blocked the loading of a resource at inline (“script-src”). Source: (function injectedScript() {...

Generally speaking - what is the best way to embed f.e. a webstore not in the iframe.
Code example:

<div id="my-store-<id>"></div> <div> <script data-cfasync="false" type="text/javascript" src="https://app.ecwid.com/script.js?<id>&data_platform=code&data_date=2020-12-20" charset="utf-8"></script><script type="text/javascript"> xProductBrowser("categoriesPerRow=3","views=grid(20,3) list(60) table(60)","categoryView=grid","searchView=list","id=my-store-<id>"); </script> </div>

1 Like

I’d like to bring this request back on the table. The plugin is great, but whenever you share such a page it only shows the default metadata. It would be great, if you could specify the title, the description and a custom image. Is the plugin still in active development or should this rather go to the marketplace category? Thanks!

I’d recommend checking out the new page publishing feature. I believe that you’ll need to take feature requests to #marketplace, as this developer is no longer actively involved with discourse.

3 Likes

Hi @pfaffman ,
What do you mean by “new page publishing feature”? Is this something built-in to Discourse? Thanks.

Hey Chris. See Page Publishing that was added to core a while back. It’s linked somewhere above, but since it was almost a year ago, it’s probably hard to find.

2 Likes

Just a note to @staff that this plugin is probably now broken. I had to disable it on my Discourse build as it was causing a 500 error whenever I tried posting with it enabled.

1 Like

Following the deprecation error message (whiteList to allowList in whitelist-tags.js.es6) in console seems to have solved it, although it needs more testing. Here’s the fork if you want to try/save a second.

I’ll make a PR in a few hours if everything seems okay.

3 Likes

I just upgraded an it’s working for me. It’s possible that it failed, I removed it, rebuilt, and then re-enabled it and rebuilt again.

3 Likes

Good to note! It could be other plugins interfering now with it. I rebuilt without it, and then rebuilt with it and it failed with the old repo. I am now attempting @TReKiE’s fix with the hope that resolves it for my configuration.

2 Likes

That did the trick! Thanks for giving this a new lease on life.

3 Likes

Well, the site can’t reply to posts and it looks like static pages is to blame.

Edit: @TReKiE 's fork seems to work for me! Thanks! Hopefully Joe will accept the pr. But really, I think it might make more sense to have you be the primary maintainer of you think you’re willing. Maybe you can get Joe to add you, or maybe your fork will be the one people use.

5 Likes

Thanks guys for testing and confirming.
The PR was merged earlier today. I’ll continue to leave my fork where it is however.

I guess we’ll see how things go for now.

2 Likes

Well, I’m now getting an infinite loop when I visit /admin/plugins

image

I also see Uncaught ReferenceError: Ember is not defined

It breaks chrome so bad that I have to reboot to get it to stop.

2 Likes

Thanks Jay.

I’ve updated my fork with fixes if you want to try that out. Will PR later when I’m more confident.

2 Likes

Nice work! Looks like you did it again!

2 Likes