ProCourse Static Pages

I’ve been doing freelance Discourse customization as my primary gig for almost a year at this point. And one of the most common questions I get is about static pages. “Can I just create a static sales page?” “Where’s a good place to put a FAQ without a discussion around it?”

You can likely argue the validity of these questions in most scenarios. The main response being “just close the topic.” But that doesn’t cut it for most. Thus, I decided to create this plugin to make it possible.

It’s pretty simple. You get a backend under Admin > Plugins to create, edit, and delete these pages as you like. It uses the same topic composer we’re used to. Once you have the page built, you can Enable it and share the link to the page wherever you like.

For a demo: LINK IS DEAD.

I should also note that styling is made easier with a class static-page in the wrapping div for the whole page. That way you can do whatever you want to the body of the page from a CSS standpoint in a theme.

46 Likes

Thanks for the cool plugin!

A small SEO request: It would be great to have extra fields for the page title and a description to fill the title and meta description.

3 Likes

Agreed. Also the ability to upload pictures would be great.

1 Like

Sorry, I did not understand how you have it on a private forum…
It’s exactly what I need.

I think that I have the same problem - this would be great, but I need the pages to be visible to anon as I have a private site and want some static pages to be exposed to the public.

@joebuhlig - this has been asked a few times in this thread. Do you have any thoughts on it?

3 Likes

This shows up after I installed it.

image

Plus my /admin/plugins list was empty until I uninstalled it. So… Pls help ! :content:

2 Likes

+·1
you said what i want to say :joy:

I determined that the error is from the code using Discourse.Model, which has been deprecated (I believe in the current version of Discourse it has been fully removed, hence the new error).

I’ve fixed the error and submitted a Pull Request:
https://github.com/procourse/procourse-static-pages/pull/13

And looks like it was merged already… woo hoo! You should be able to reinstall the plugin now.

3 Likes

I don’t think Joe is maintaining his plugins these days. Someone else will need to create a PR.

That said, we are currently working on a static page feature in core. It’s still in its early stages, but you can try it out by enabling the enable page publishing setting in your site settings. You can create a published page by opening up the post actions menu on a topic (select the … button followed by the wrench button).

13 Likes

It does work, actually ! Thanks :smiley:

2 Likes

:heart:

Oh! Finally! This is pretty great. This might be enough that a bunch of people can stop using WordPress. Oh. Yes. So fantastic.

:heart:

10 Likes

This is great - have you got any tips for how we access them for styling?

I guess it’s too soon to put too much work into design for your forum since it’s in development, but right now everything is here

https://github.com/discourse/discourse/blob/master/app/assets/stylesheets/publish.scss

4 Likes

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:

4 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!