Este guia abrange como usar o recurso de Publicação de Página (Page Publishing) no Discourse. Este recurso permite que usuários com nível de acesso Staff convertam um tópico em uma página estática autônoma com estilo personalizado. Exemplos incluem as páginas de Termos de Serviço e Política de Privacidade.
Nível de usuário necessário: Staff
Publicando páginas estáticas no Discourse
A Publicação de Página (Page Publishing) permite que usuários Staff criem páginas estáticas autônomas a partir de tópicos. Isso é semelhante ao processo de criação de páginas de Termos de Serviço ou Política de Privacidade.
Sumário
Esta documentação abordará:
- Habilitando a Publicação de Página
- Publicando um tópico como uma página
- Despublicando um tópico
- Problemas comuns e soluções
- FAQs
- Recursos adicionais
Habilitando a Publicação de Página
- Navegue até
Admin>Settings(Configurações).- Ative a configuração
enable page publishing(habilitar publicação de página).
Habilitando a publicação de página quando o login é necessário
Para permitir que as páginas publicadas sejam visíveis mesmo quando um usuário não está logado:
- Ative a configuração
show_published_pages_login_requiredemAdmin>Settings(Configurações).
Publicando um Tópico
Vá para a primeira postagem de um tópico público e selecione o ícone de reticências (
...).
Selecione o ícone de chave inglesa.
Escolha a opção "Page Publishing" (Publicação de Página).
Um diálogo modal aparecerá, permitindo que você confirme o slug (que pode ser pré-preenchido a partir do título da postagem) e visualize o URL da página publicada.
Para permitir a publicação de páginas, é necessário desativar as configurações de site de upload seguro.
Para sites hospedados, uploads seguros são limitados ao plano Enterprise.
Tópico Publicado
Se a opção
Public(Público) estiver marcada, um rótulo public aparecerá.
Um tópico publicado mostrará um aviso abaixo do título permitindo acesso às suas configurações de publicação.
Página Publicada
Despublicando um Tópico
Selecione
Publishing Settings(Configurações de Publicação) sob o aviso.
Clique em Unpublish (Despublicar)
A página é despublicada.
Problemas comuns e soluções
Não consigo ver páginas publicadas quando deslogado
Certifique-se de que a configuração
show_published_pages_login_requiredesteja ativada emAdmin>Settings(Configurações).Adicionando um cabeçalho do Discourse a páginas publicadas
Atualmente, as páginas estáticas são projetadas para serem mínimas e não incluem o cabeçalho e rodapé típicos do Discourse.
FAQs
Posso tornar uma página de FAQ ou Sobre pública?
Você pode criar um novo tópico com o conteúdo desejado e publicá-lo como uma página. Altere os links nas configurações do site para apontar para essas novas páginas.
Como posso personalizar a aparência de uma página publicada?
Use a estrutura do documento HTML e os seletores CSS correspondentes para aplicar estilos personalizados em
Admin>Customize(Personalizar) >Themes(Temas) >CSS.Recursos adicionais
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!
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.
Something that would go nice with this feature is to make publications onebox-compatible such that people could easily share the content.
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!
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.
GTM not loaded on published pages? Would be nice.
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?
Yes I think we already support having a text/javascript in the theme fields, so there are certainly solutions in this area.
That would be great.
So it’s currently impossible to have responsive published pages, and this site particularly wants
- images made available when sharing to public media, and
- responsive/resizing images displayed, especially on mobile–oh, mobile could just resize the image with CSS–that should work, right?
+1 for having the Discourse header in published pages. I’m missing my website logo, custom header links and beloved hamburger menu 
Another oddity: in posts, my lightboxed images open in a nice popup, whereas in published pages, they open in a new tab…
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!
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 ?
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…
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?
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.
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?
Unfortunately, the “Page Publishing” feature doesn’t meet my needs. For me to use it, I would need published pages:
- 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
- to be rendered like normal (decorated) topics, i.e. supporting bbcode and plugins.
In the meantime I used the default Discourse customization facility:
- Identify the added element, e.g., with a
published-page-footer-linksCSS class. - Customize CSS to hide this element by default and show it only for published pages
- Add the element in the
Footerspace
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>











