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 « J'aime »

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 « J'aime »

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

1 « J'aime »

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 « J'aime »

This shows up after I installed it.

image

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

2 « J'aime »

+·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 « J'aime »

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 « J'aime »

It does work, actually ! Thanks :smiley:

2 « J'aime »

: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 « J'aime »

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 « J'aime »

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 « J'aime »

Full instructions at Page Publishing

1 « J'aime »

C’est exact. Je sais que ce plugin est principalement conçu pour créer des pages statiques. Cependant, imaginons que vous créiez une application de calculatrice que vous souhaitez intégrer à la page. La calculatrice nécessite une saisie de l’utilisateur. La page conserve son code statique, mais elle mettrait à jour le résultat en fonction de la saisie de l’utilisateur. Est-ce possible avec ce plugin, ou vaut-il mieux créer une page HTML/CSS externe avec du JavaScript ?

1 « J'aime »

Je souhaite utiliser un widget tiers sur une page statique. Le JavaScript correspondant doit être inséré avant . Existe-t-il un moyen de le faire uniquement pour cette page statique précise ? Merci pour votre aide !

Je partage simplement comment j’ai réussi à exécuter un script pour les pages statiques :

<script type="text/discourse-plugin" version="0.8">
    const { setDefaultHomepage } = require('discourse/lib/utilities');
    const user = api.getCurrentUser();
    if(!user) {
        setDefaultHomepage('/page/welcome/1/'); // <--- définir l'URL de la page d'accueil
    }
    api.onPageChange((url, title) => {
        if(url.indexOf("/page/welcome") === 0) {
            // faire quelque chose pour cette page statique
        }
    });
</script>

Une précision : définir la page comme page d’accueil est tout à fait facultatif lorsqu’il s’agit d’exécuter le script. Je voulais simplement montrer que c’est possible aussi :+1:

4 « J'aime »

Merci !
Connaissez-vous un moyen d’utiliser des scripts externes (non provenant du même domaine) pour une page statique ?
On obtient toujours :
Content Security Policy : Les paramètres de la page ont bloqué le chargement d'une ressource en ligne (« script-src »). Source : (function injectedScript() {...

De manière générale, quelle est la meilleure façon d’intégrer, par exemple, une boutique en ligne sans utiliser de cadre intégré (iframe) ?
Exemple de code :

<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 « J'aime »

Je souhaite remettre cette demande sur la table. Le plugin est excellent, mais chaque fois que vous partagez une telle page, seules les métadonnées par défaut sont affichées. Il serait idéal de pouvoir spécifier le titre, la description et une image personnalisée. Le plugin est-il toujours en développement actif, ou devrais-je plutôt poster cela dans la catégorie Marketplace ? Merci !