Page Publishing

:bookmark: This guide covers how to use the Page Publishing feature on Discourse. This feature allows Staff/Admin users to convert a topic into a standalone static page with custom styling. Examples include the Terms of Service and Privacy Policy pages.

:person_raising_hand: Required user level: Admin

Publishing static pages on Discourse

Page Publishing allows Admin users to create standalone static pages from topics. This is similar to the process for creating Terms of Service or Privacy Policy pages.

Summary

This documentation will cover:

  • Enabling Page Publishing
  • Publishing a topic as a page
  • Unpublishing a topic
  • Common issues and solutions
  • FAQs
  • Additional resources

Enabling Page Publishing

  1. Navigate to Admin > Settings.
  2. Activate the enable page publishing setting.

Enabling page publishing when login is required

To allow published pages to be visible even when a user is not logged in:

  1. Activate the show_published_pages_login_required setting at Admin > Settings.

Publishing a Topic

  1. Go to the first post of a public topic and select the ellipsis icon (...).
    Ellipsis Menu

  2. Select the wrench icon.
    Wrench Icon

  3. Choose the ā€œPage Publishingā€ option.
    Page Publishing Option

  4. A modal dialog will appear, allowing you to confirm the slug (which can be pre-filled from the post title) and preview the published pageā€™s URL.
    Publishing Dialog

:warning: To allow page publishing, itā€™s necessary to deactivate the secure upload site settings.

:information_source: For hosted sites, secure uploads are limited to the Enterprise plan.

Published Topic

  • If the Public option is checked, a public label will appear.
    Public Option
    Published Public Topic

  • A published topic will show a notice under the title allowing access to its publishing settings.

Published Page

Unpublishing a Topic

  1. Select Publishing Settings under the notice.

  2. Click Unpublish
    Unpublish Topic

  3. Page is unpublished.
    Unpublished Topic

Common issues and solutions

Unable to see published pages when logged out

Ensure the show_published_pages_login_required setting is activated in Admin > Settings.

Adding a Discourse header to published pages

Currently, static pages are intended to be minimal and do not include the typical Discourse header and footer.

FAQs

Can I make a FAQ or About page public?

You can create a new topic with the desired content and publish it as a page. Change the links in site settings to point to these new pages.

How can I customize the look of a published page?

Use the structure of the HTML document and corresponding CSS selectors to apply custom styles under Admin > Customize > Themes > CSS.

Additional resources

Last edited by @yigit 2024-07-19T18:36:54Z

Last checked by @huynhthai824 2024-05-27T12:26:36Z

Check documentPerform check on document:
116 Likes

I still need to try this out first hand so the following may not be grounded in reality, but:

It strikes me that this permission model sets up a scenario where you always see two copies of the pagesā€™ content ā€“ one in the relevant Discourse category, and one in the published pages themselves. This of course seems duplicative if youā€™re wanting to publish pages for the general population that is similar to, or identical to, your Discourse user base.

OTOH, if pages had the ā€œworld readableā€ flag available, you could then restrict who can see/edit them to a small group, and the only place the content would be available to other Discourse users would be in the published links themselves.

(Iā€™m thinking of a use case of a ā€œdocumentation siteā€ here.)

Otherwise, Iā€™m pretty excited to test things out!

7 Likes

Awesome stuff, and thanks again for listening to your users. I love the ā€˜lets make this better for us allā€™ vibe that Discourse has! Weā€™ll make heavy use of this.

When discussing one use (patching up an install that went a bit awry), another user pointed out a remaining bit of icing that could do with going on the cake:

Hey, is there any way to include the ability to make /faq and /about public as well, as they are currently hidden in Login Required sites. We can of course use the existing functionality that youā€™ve just released for /faq by making our own, changing the link in settings, and explicitly linking to it. However, this is not pretty and the existing navigation to it remains hidden. We canā€™t do that at all for /about of course.

9 Likes

Something that would go nice with this feature is to make publications onebox-compatible such that people could easily share the content.

15 Likes

Please excuse my ignorance, as I am very much a beginner in the HTML/CSS spaceā€¦ however, how would we go about applying our theme colour choices to published pages. At its simplest, Iā€™d like to use the dark background/white text to give the published pages the same darkmode experience as accessing our forums.

Is this already in the product, or do I need to play with HTML/CSS? If the latter, could anyone give me some pointers in the right direction? Thanks!

4 Likes

Can you make this a separate feature request please? This is not related to page publishing, as in I wouldnā€™t have to change anything related to page publishing to make it possible. I do agree it would be better if all these ā€œstaticā€ pages could have more or less the same behaviour, but there are multiple solutions here (do nothing? add site settings? migrate these to page publishing?), so we might want to have a dedicated topic for this.

8 Likes

GTM not loaded on published pages? Would be nice.

2 Likes

Hmm that is a really good point.

Just trying to think of a solution hereā€¦ would it work if type="text/javascript" and type="text/discourse-plugin" were treated differently? The API needs the latter, right?

5 Likes

Yes I think we already support having a text/javascript in the theme fields, so there are certainly solutions in this area.

7 Likes

That would be great.

1 Like

So itā€™s currently impossible to have responsive published pages, and this site particularly wants

  1. images made available when sharing to public media, and
  2. responsive/resizing images displayed, especially on mobileā€“oh, mobile could just resize the image with CSSā€“that should work, right?
6 Likes

+1 for having the Discourse header in published pages. Iā€™m missing my website logo, custom header links and beloved hamburger menu :slight_smile:

Another oddity: in posts, my lightboxed images open in a nice popup, whereas in published pages, they open in a new tabā€¦

7 Likes

I think whatā€™s needed is a set of theme components that add such. The last client I had to use this wanted the topic creator removed. I think itā€™s hard to guess what will meet peopleā€™s needs for this!

6 Likes

Are there currently any ongoing efforts for adding ā€œsimpleā€ (non-API) Javascript support to published pages? Or should we forget about this near- to mid-term ?

9 Likes

Can i display external non-Discourse JSON on this page? Because we canā€™t use php code here and discourse strip most of html so i do not know how to do itā€¦

2 Likes

I have a problem with a published page - the button to copy the content of the code block is not visible on a published page. Screenshot: Screenshot by Lightshot. I move the mouse over the block, but the button doesnā€™t appear. When logged in - everything works as usual - ok.

Can anybody repeat the problem? Any solution?

2 Likes

Thank you @riking !

It indeed seems that ā€œregularā€ text/javascript is executing on published pages when itā€™s in the header or footer of a theme component.

7 Likes

Ha! So it seems that thereā€™s a hacky way to make some theme components work with page publishing.

Iā€™m looking into adding some header/footer to the published pages, and theme components seem to be the way to go. But it seems bad to go on and implement something that would potentially break in the near future.

@riking, it looks like the text/javacript type in header or footer working on published pages was unintented. Is it going to be fixed or used to extend published pages?

@syl, author of DiscPage, mentioned the possibility to re-implement the DiscPage plugin using Page Publishing functionality. Do you still have this in mind, @syl? What do you think would be the path of least resistance to integrate both functionality @riking?

7 Likes

Unfortunately, the ā€œPage Publishingā€ feature doesnā€™t meet my needs. For me to use it, I would need published pages:

  1. to be displayed within the normal Discourse layout, i.e. with the standard Discourse header (just like the Terms of Service and the Privacy Policy), and
  2. to be rendered like normal (decorated) topics, i.e. supporting bbcode and plugins.
14 Likes

In the meantime I used the default Discourse customization facility:

  1. Identify the added element, e.g., with a published-page-footer-links CSS class.
  2. Customize CSS to hide this element by default and show it only for published pages
  3. Add the element in the Footer space

2. In CSS, add:

/* Only show footer links on published pages */
.published-page-footer-links { display: none; }
.published-page .published-page-footer-links { display: block;}

3. in Footer, add:

<nav class="published-page-footer-links">
Hi there! This is the footer for published pages!
</nav>
8 Likes