FEATURE: Support for publishing topics as pages (PR #9364)

If the feature is enabled, staff members can construct a URL and publish a topic for others to browse without the regular Discourse chrome.

This is useful if you want to use Discourse like a CMS and publish topics as articles, which can then be embedded into other systems.

How to use:

  1. activate enable page publishing in settings.

  2. On a top, click this in the OP: image

  3. Build your custom URL: image

  4. Your article will be published and you can visit it and read with no Discourse chrome:

image

GitHub

1 Like

This file shouldn’t be part of this commit right ?

this.setProperties({ state: States.existing, publishedPage: page });

catch(this.startNew)

this.publishedPage.slug

      data: { slug: this.publishedPage.slug }

couldn’t we use a store ?

could use setProperties

It should be noted that this template if often overridden by users with complex customisations, and we should take actions to ensure a migration is done safely.

Do I read this right, that any post can be converted to a CMS page ?

I think we should always avoid direct styling, if we think it’s worth styling others will probably do too, and we should provide a class.

this line should be group with others

didnt you want to publish this as a separate commit ?

I do think it’s always a good practice to return it when you have a promise

I’m not exactly sure what would be the different to just use: Discourse.getURL(pub/${this.slug}) ?

Might be wrong on this, but AFAIK model.destroy won’t raise on failure, so you might failed to destroy the page and still log an unpublished_page event

that’s a minor nitpick, but when writing custom validator, I love to have them grouped. I think it makes things easier to read.

eg:

validate :slug_format
def slug_format
  # logi
end

given it doesn’t soon like we use the id of this model maybe we could get rid of the auto increment and store the topic_id in the id column as primary_key

I think you can use response.parsed_body instead of this

Is there a visual indicator on the topic itself that it is “published” and at some URL? I think we need that. Like a blue “staff notice” at the top of the topic perhaps? (If we already have it, disregard)

On Mon, Apr 6, 2020 at 1:14 PM Robin Ward notifications@github.com wrote:

If the feature is enabled, staff members can construct a URL and publish a topic for others to browse without the regular Discourse chrome.

This is useful if you want to use Discourse like a CMS and publish topics as articles, which can then be embedded into other systems.

How to use:

activate enable page publishing in settings. 2.

On a top, click this in the OP: [image: image] https://user-images.githubusercontent.com/17538/78600625-3d8b1380-7821-11ea-8264-6c00e8ce565e.png 3.

Build your custom URL: [image: image] https://user-images.githubusercontent.com/17538/78600717-762aed00-7821-11ea-8a70-529d615a949b.png 4.

Your article will be published and you can visit it and read with no Discourse chrome:

[image: image] https://user-images.githubusercontent.com/17538/78600767-9195f800-7821-11ea-9510-17cbf35d6c1f.png

You can view, comment on, or merge this pull request online at:

https://github.com/discourse/discourse/pull/9364 Commit Summary

  • FEATURE: Support for publishing topics as pages

File Changes

Patch Links:

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/discourse/discourse/pull/9364, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALTWVKIXN5LQX3SL4MR3MLRLIZZHANCNFSM4MCSEM2A .