Page Publishing

One obvious drawback to using CSS for “removing” content, is that it’s not actually removed, just hidden. Therefore you’re loading data that your client won’t be using.

My intention with this question below was to determine a common way for Discourse practitioners to recognize a way to the discussion across instances.

3 Likes

@hellekinacross instances” of what?

Are you using Wordpress?

… or Ghost?

There is a new, even tighter integration with Ghost and Discourse that enables Single Sign On…

There is also this plugin…

3 Likes

Across instances of Discourse.

Hello, I currently have a discourse site that requires login to see and do anything. I want to use the publish topic feature to create a homepage for my users but since I’m also using secure media, I’m getting the below error. Is there anyway around this? I tried the procourse-static-pages (doesn’t work with the latest version of discourse, I’m unable to save a new page. The security group drop down box is not being populated so that might be the issue) and discpage (doesn’t seem to work with a custom theme I’m using) plugins. So I’m really hoping I can get this feature to work. Does anyone have any advice?

2 Likes

WoW!
What an amazing tweak you’ve made out of Discourse, congrats and thanks for sharing :)
:heartbeat:

1 Like

this is very cool. well done and thank you for sharing :+1:

1 Like

Thanks, @brasofilo and @Lilly! I’m planning some Theme Components based on this, and related use cases.

4 Likes

Unless I missed something on this feature, the published page only shows the initial post, not the answers to it. If that’s the intended behavior, is there a way (plugin?) to make the standalone page also show all the replies to the initial post?

Hi Raphael,

This is the purpose of published pages. :slight_smile:

Published page has limited access to many Discourse features.
The only workaround would be using a trick like Page Publishing - #145 by denvergeeks but the published page won’t have a custom URL (and will load useless thing in the background).

1 Like

Hello Danielle,
Unfortunately, I have no other advice than opening a new feature page-publishing topic and ask if something can be done about it.

Pay Publishing is a cool idea and feature that’s new to me and in particular the above is how I assumed it might work too.

This would opens up the ability to present content with more control while having the majority of your discourse logion_required, best of both world, you may still need to hook in new users or ut valuable information you want ot leave open to all on the web, including crawlers.

A simple option like:

Allow Published Pages Display on Login_required page

Would be a good start.

Maybe the /pub/ could also be a default landing page to display all pub pages in a simple list preview, as a matter of course.

I really didn’t know this feature was available until investigating login_required.

Indexing Published Pages

While we’re waiting for the Index or search published pages feature, here is a way to do it manually.

Finding Published Pages

Using the Discourse Data Explorer you can create a new Published Pages query:

SELECT CONCAT('/pub/', pp.slug) AS URL, pp.topic_id
FROM published_pages pp
ORDER BY pp.id

Providing an Index

Surely one can Run Data Explorer queries with the Discourse API to create and maintain an index of published pages. This might even be doable with the Custom Wizard Plugin 🧙.

I manually created a new topic using the data from the Published Pages query above, then published it at /pub/index.

Since I Run other websites on the same machine as Discourse, I could easily make the published pages index available at https://discourse.example/pub with this snippet:

    # Provide an index to published pages
    location ~* ^/pub/?$ {
        return 307 https://discourse.example/pub/index;
    }
5 Likes

Adding my name to this list :blush:

Is there a way to alter the routing to remove the /pub/ from the URL of the published page?

For example, this published page:

https://example.com/pub/my-magic-page-here

Would become:

https://example.com/my-magic-page-here

:thinking:

1 Like

Hi @Richie - you can do this with permalinks (admin-customize-permalinks). Put the “my-magic-page-here” slug in the first field, use the External URL option in the drop down, then add the published page URL in the URL field. Note however, that the permalink won’t work as a URL in a custom menu section, still need the actual published doc URL.

2 Likes

Hi, beside using css to do display none how can I remove the user that is publishing the page?

Also is there anyway to add a link back to the forum?

1 Like

Another way is to change the owner of the Topic to @system or some other generic user

Easiest way is to do that manually, simply as a link in the OP markdown.

You could probably spin up a TC to do it automatically without too much trouble (depending on what you want to link back to). Try marketplace for that.

2 Likes

Thanks, I actually managed to solve this.

2 Likes

Do share how!

3 Likes

With javascript I removed the element from the page on page load and I added an anchor link to the header after the logo to return back to the forum.

<script type="text/javascript">
  window.addEventListener('load', function() {
    var header = document.querySelector('.published-page-content-header');
    if (header) {
      header.parentNode.removeChild(header);
    }
  });

 window.addEventListener('load', function() {
    var headerWrapper = document.querySelector('.published-page-header-wrapper');
    if (headerWrapper) {
      var backToForumLink = headerWrapper.querySelector('a');
      if (backToForumLink) {
        var customHtml = '<a href="/" >Back </a>&nbsp;&nbsp;';
        backToForumLink.insertAdjacentHTML('afterend', customHtml);
      }
    }
  });
</script>
3 Likes