Page Publishing

Page Publishing

Page Publishing allows Staff/Admin users the ability to convert a topic into a static standalone page with support for custom styling. This is similar to the pattern in use for Terms of Service or the Privacy Policy pages. Note that published pages will respect the visibility rules of the associated topic.

Enable Page Publishing

Activate enable page publishing under Admin > Settings

Publish a Topic

On the first post of a public topic, hitting the ... menu (1) will reveal the wrench (2), which in turn will reveal the post administration menu (3), with a new option:

  1. Go to post #1 and select the ellipsis icon…
    image

  2. Select the wrench icon
    image

  3. Select “Page Publishing”
    image

This reveals a modal dialog proposing to publish the topic as a page, where you can choose the (pre-filled) slug, just as you would do for a category’s slug – it’s automatically generated from the post title. You will also get a preview of what your published page’s URL will look like.

Published Topic

A published topic shows a notice under the title that allows access to its publishing settings:

Unpublish a Topic

Selecting Publishing Settings will bring up options that allow you to unpublish the topic

Styling of a Published Page

The structure of a published page makes it easy to customize its CSS style:

Beginning of the HTML document of a published page
<body class="published-page">
    <div class="published-page-wrapper">
        <div class="published-page-header">
            <h1 class="published-page-title">Guide for ActivityPub users</h1>

            <div class="published-page-author">
                <img width="45" height="45" src="/letter_avatar_proxy/v4/letter/n/da6949/90.png" class="avatar">
                <div class="published-page-author-details">
                    <div class="username">nedjo</div>
                    <div class="topic-created-at">February 8</div>
                </div>
            </div>

            <div class="published-page-body">
The relevant CSS selectors
CSS Selector Affects
body.published-page the whole page (or simply: .published-page) Note that slug, category and tags will also be appended as css classes
.published-page-wrapper a div around the content
.published-page-header the title and authorship information
.published-page-title the topic title (h1 tag)
.published-page-author the avatar, name of the author, and topic creation date
.published-page-author .avatar the avatar
.published-page-author-details the username and topic creation date
.published-page-author-details .username the author’s username
.published-page-author-details .topic-created-at the topic’s creation date
.published-page-body the page contents

You can go to Admin > Customize > Themes > CSS and play with it.

Additional Notes:

Big special thanks to @hellekin for starting the documentation and providing us with valuable feedback.

Wiki Page

It’s possible to “publish” a wiki page, which means every member, not only Staff, can update it.

Theme Component

Users can look at creating a theme component to supplement the published pages.

47 Likes

This is awesome! Thanks.

The thing that needs to be mentioned here is that these pages are visible only to those who can see the topic (right?). This means that (1) login_required sites can’t use this to publish stuff for anonymous (not logged in) users (I think that this is the only point that might need to be made even more clear), and (2) the permissions of the category where the document is housed are significant (right?).

oops:

11 Likes

Great question and yes you’re right! Sites w/ “login_required” will not be able to publish pages for anonymous users.

A user will be redirected to the login page should they click a published page URL.

8 Likes

Actually I edited it to show topic and not category, this is more correct.

5 Likes

I’ve seen a number of people wanting this to have info pages for login-required sites (e.g., how to pay, what it costs, and so on). Seems like a difficult problem to solve. Is that on the roadmap?

11 Likes

I’m running a login_required Discourse forum and it would be absolutely fantastic if published pages could be made visible to anonymous users the same way that /tos and /privacy pages are.

7 Likes

Nothing’s set in stone at the moment so taking in all the feedback!

Noted!

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

2 Likes

Amazing work guys! Looking forward to test the feature in my community

2 Likes

:sparkles: Lovely! :sparkles:

The only issue I can see is that there is no favicon or page title in the browser tab - see screenshot. The left tab is the page title for the topic in discourse, the right tab is the published page with URL and no favicon.

13 Likes

Great news!

A doubt:
The “pub” slug, I mean the word “pub” in the URL: /pub/ … is it customizable?

4 Likes

Another feature request for the queue:

A toggle to include the site header/navigation at the top of the published pages, to help the pages fit in more with the general site theme.

5 Likes

Well, that’s something we should fix @sam.

8 Likes

This is a FANTASTIC addition! :partying_face:

8 Likes

This should be fixed by:

It will also add few other missing tags.

Thanks for report @tobiaseigen

11 Likes

This looks awesome!

And yet another feature request: allowing a published page to be the home page.

4 Likes

I think that my GitHub - pfaffman/discourse-allow-arbitrary-homepage: allow an admin to specify the default homepage to any URL. will allow you to make a static page your home page. (I’m not sure that it’s a good idea, but you can give it a try)

3 Likes

Are these pages will shows under “SiteNavigationElement” or “DiscussionForumPosting” in Google Structured Data Testing Tool?

This is great, thank you!

This makes me think, @joffreyjaffeux, that Discourse plugins are applied to published pages (e.g., footnotes) but theme components are not (e.g., table of contents). It might be tricky to implement since some components are not necessarily useful in the context of pages, but ToCs are definitely useful. Any chance we can have it?

4 Likes