Estilo de Publicación de Blog

:discourse: Resumen Blog Post Styling (Estilo de Publicación de Blog) te permite designar una categoría de blog, lo que altera la apariencia de los temas dentro de la categoría para que se parezcan más a publicaciones de blog tradicionales.
:eyeglasses: Vista previa Vista previa en theme-creator.discourse.org
:hammer_and_wrench: Repositorio github.com/discourse/discourse-blog-post-styling
:open_book: ¿Nuevo en Temas de Discourse? Guía para principiantes sobre el uso de Temas de Discourse

Instalar este componente de tema

El componente de tema Blog Post Styling transforma los temas de Discourse en un diseño de publicación de blog tradicional. Cuando se aplica a una categoría, la primera imagen en cada tema se promociona a un héroe de ancho completo sobre el título, y el contenido se estiliza con tipografía apropiada para blogs y visualización de metadatos.

Configuración

Aquí están las diversas configuraciones asociadas con este componente de tema:

  • Categoría de blog: La “slug” (identificador) de la categoría que debe usar el estilo de publicación de blog. Para agregar a más de una categoría, use una lista separada por comas sin espacios (ejemplo: blog,anuncios). Para encontrar la “slug”:

    • Para categorías, tome la ruta de la URL después de /c/ — así que para /c/blog/, la “slug” es blog.
    • Para subcategorías, tome la ruta de la URL después de /c/ y reemplace cualquier / con -. Por ejemplo, una categoría en /c/blog/tutorials se convierte en blog-tutorials.
  • Etiqueta de blog: Elija una o más etiquetas que, cuando se apliquen a un tema, le darán el estilo de publicación de blog.

  • Tamaño de la imagen: Decida cómo la imagen destacada (héroe) llena el área del encabezado:

    • Sin imagen: Ocultar la imagen destacada.
    • Ancho completo (predeterminado): La imagen se extiende por toda el área de contenido.
    • Centrada: La imagen mantiene la relación de aspecto y se centra en el área de contenido.
  • Posición de la imagen: Decida dónde mostrar la imagen en relación con el título:

    • Encima del título (predeterminado): Mostrar la imagen encima del título del tema.
    • Debajo del título: Mostrar la imagen debajo del título del tema. Cuando se selecciona, también puede incluir un resumen que se muestra entre el título y la imagen. A continuación, puede ver cómo se ve la imagen cuando la configuración de posición de la imagen está configurada en encima del título y debajo del título:
  • Letra capital (Dropcap) habilitada: Cuando está habilitada, la primera letra de la publicación del blog tendrá un estilo ampliado, como este:
  • Móvil habilitado: Cuando está habilitado, el estilo de publicación de blog se aplica al leer el tema en dispositivos móviles.

Escribir una publicación de blog

Una vez que haya configurado su categoría de blog (o aplicado su etiqueta de publicación de blog), hay algunas cosas especiales a tener en cuenta sobre cómo funcionará el tema de la publicación de blog.

Imagen destacada

Coloque la imagen que desea como imagen principal en la primera línea de la publicación, seguida de una línea en blanco antes de que comience su contenido:

![descripción de la imagen|1100x440](upload://your-image-hash.jpg)

El contenido de su publicación comienza aquí...

El componente posiciona automáticamente esta imagen según la configuración de posición de la imagen (ver arriba). Si aparece cualquier otro contenido —incluidas las líneas en blanco— antes de la imagen, no se promocionará a la posición de héroe.

Después de publicar una publicación por primera vez, actualice la página para ver la imagen aparecer en la posición designada. (Esto solo afecta al autor de la publicación en la publicación inicial; los miembros que accedan a la publicación deberían ver la imagen en el lugar correcto de inmediato).

Consejos de tamaño de imagen

El contenedor de la imagen tiene 440px de alto y 100% de ancho. Para obtener mejores resultados cuando la configuración de tamaño de la imagen está establecida en ancho completo:

  • Use o recorte imágenes a 1100x400px antes de subirlas para evitar recortes, o
  • Elija imágenes con un sujeto centralizado o contenido no específico (paisajes, patrones) para que el recorte no elimine detalles importantes.

Resúmenes

Cuando la configuración de posición de la imagen se establece en debajo del título, puede agregar un resumen opcional a su publicación de blog, que aparecerá entre el título y la imagen destacada.

Para hacer esto, envuelva el contenido que desea que aparezca en su resumen de la siguiente manera:

[summary] Este es el contenido que será su resumen. [/summary]

Citas de bloque estilizadas

Al crear temas en una categoría de blog, las citas de bloque reciben un estilo especial. Puede crear citas de bloque en el compositor con el símbolo > o usando el botón de la barra de herramientas del compositor <kbd>“</kbd>.

Configuración de categoría recomendada

En la configuración de su categoría de blog, considere habilitar la configuración de categoría Navegar a la primera publicación después de leer los temas. Esto envía a los lectores recurrentes directamente al contenido de la publicación del blog en lugar de a su posición de última lectura.

Blog Post Styling + Miniaturas de la Lista de Temas

Este componente es compatible con Topic List Thumbnails (Miniaturas de la Lista de Temas), que resalta la imagen destacada de su publicación de blog en la lista de temas:

Nota: El componente Topic List Thumbnails no es compatible con el tema Horizon. La captura de pantalla anterior está utilizando el tema Foundation.

104 Me gusta

We just have been able to verify that by bumping the original markup materialized after upload by just injecting a zoom level of 101% at the appropriate place like

![image|690x458,101%](upload://4BWmapYzkwTQrWlm1JkeUwefYrC.jpeg)

after the respective image had been uploaded beforehand as

![image|690x458](upload://4BWmapYzkwTQrWlm1JkeUwefYrC.jpeg)

This is cute and makes us happy.


3 Me gusta

Hello, and thank you very much for dedicating the time to create this and release it for free.

I was just wondering if it would be at all possible to change this somehow to use a specific tag instead of a particular category?

I just setup a new discourse website but I’ve been writing a lot of “blog posts” but I would still like these to show up in the appropriate other categories in order to make it seem a little more integrated.

Currently I have been posting them in their own blog-posts category, which I limited to just me being able to post in there, but I just setup a tag group and made that only accessible to staff.

Thanks again!

3 Me gusta

Thanks very much @tshenry. Your theme components have all been spot on.And to @sam and @codinghorror for sharing an incredible app!! Your generosity including the support in meta is heartfelt. Discourse is indeed made for the more caring internet of the future.

6 Me gusta

Is there a way to make this work with a video as the featured content rather than the image? I would delete my wordpress site if I could just post the YouTube/Vimeo etc. and have that be the top content. Any ideas?

6 Me gusta

Totally! Great suggestion @LoganRTW. It’s got my vote @tshenry. Can it be done?

4 Me gusta

Update :tada:

If you can believe it :sweat_smile:

I have started refactoring/cleaning up the component to use the plugin-style file structure and make use of the new topic thumbnails.

https://github.com/discourse/discourse/pull/9215

I’ve added a couple new features as well:

  • New settings
    • image_display_style - there are two options with this. The default should be the behavior the component has had all along. The alternative will ensure there is no cropping and the full image is displayed. It’s hard to say which one is “better” so you’ll want to do some experimentation and see what works best for your workflow and blog images.

    • mobile_enabled - this is a first pass on the mobile blog post style. I’m interested to hear any bug reports or ideas for improvements on this!

I still want to continue refactoring and cleaning up the code, but this should be a good start.

https://github.com/tshenry/discourse-blog-post-styling/commit/eba3c52fc1f9b273d34e9d673567410e4566372e


No plans at this point, I’m afraid!

16 Me gusta

Thank you for a really inspiring and nice component @tshenry :pray:

In my evaluation I have identified two issues;

  1. No blog image in sub categories - after quite extensive troubleshooting with different themes and enabling/disabling both plugins and other components, I think I can state with near certainty that blog images won’t render for sub categories. The first image/the intended blog image is however still hidden.

  2. First image not hidden inline with DiscoTOC - When Blog Post Styling is used together with DiscoTOC, the blog image get rendered above the title correctly - however, it is rendered twice as it is still rendered in its original position as well.

4 Me gusta

Thanks so much for the feedback @torstensson! Both points were indeed bugs and should now be fixed:

Please let me know if you continue to have any issues.


To everyone using this component:

:warning: If you are not currently including a featured image at the top of all blog posts, this is for you!

This component was created with the intention of having an image display above every blog post topic. With that said, it was possible to create a blog post without displaying a featured image by simply not including an image on the first line of the post. This behavior has changed.

The newer implementation greatly improves performance, but it uses a predefined value rather than looking at the post contents itself. The predefined value is generated from the first image found in the post. Unlike before, it is not necessarily limited to an image appearing as the first line of the post. This means if you create a post without an image on the first line, but you include a single image at the bottom of the post, that image at the bottom will now also be displayed above the topic.

I have included an all-or-nothing setting that can toggle on/off the “featured image,” allowing you to have all of the styling except for the featured image if that is your preference.

I am going to update the OP with all of the new considerations and recommendations, but the short of it is to make sure to include an image on the first line of the post (this positioning is still used to make sure the image is not repeated). You may find it is helpful to use a placeholder image in the category’s topic template that can be used as a default if no image is provided.

6 Me gusta

Awesome, thank you @tshenry :awthanks: I can gladly confirm that both issues have been resolved with the update :slightly_smiling_face: and again - thank you for a really great component, not only in function but inspiration as well :+1: :+1:

3 Me gusta

A recently announced feature may work as an alternative to this theme-component. Leaving it here for those interested.

2 Me gusta

@tshenry Thanks so much for this component! :heart: We are using it along side the Topic List Previews plugin to create an Articles section for students in the Dataquest Community.

I have a feature request for you to consider in future iterations of this component - Can you please add the ability to add Canonical URLs to the articles?

Search engines use canonical links to determine and prioritize the ultimate source of content, removing confusion when there are multiple copies of the same document in different locations.

Thanks!

3 Me gusta

So I think this is a great component. In fact I am now trying it out on a live Discourse and I am playing around with it. Without any kind of order, I want to provide my initial thoughts and feedback, hope it helps - forgive me if some of them might be more of a question:

  • The way the author is displayed is a bit out of place and could maybe be solved more space-efficient, to tie it in closer with the title, or category tag etc… there is also rather much white space between the line that ends the author info and the beginning of the text
  • It is hard for a vistor sent directly to a blog post to realize where you are, as there is no clear breadcrumb or anything. The main reason is, that the title bar seems to be turned inactive, whereas on normal topics they transform and include the title, category etc.
  • Would be great if the category view could have more of a blog look, with small preview images and such, would that be hard to do?
  • I don’t see a category description in the category view?
2 Me gusta

wow what theme component is used for that category view? Looks cool

2 Me gusta

Thanks for the feedback :slight_smile:

I do agree there is a lot of white space around the author/title area. I’ll keep this feedback in mind next time I work on the component and see if I can come up with something.

I’m not 100% sure what you mean here. The header will switch to include the title/breadcrumbs once you scroll down past the image and blog title. You are correct that at the top of the page, it’s not especially obvious, though. I’ll keep this in mind as well.

These would be out of scope for this component. For the category view, you might want to take a look at: Topic List Thumbnails

2 Me gusta

Thanks for the feedback :slight_smile: I think most of it is cleared up, and I also do see the category description now, not sure why it wasn’t visible earlier, I thought it had something to do with the component. I will keep trying this out and post more feedback later. Excellent work!

3 Me gusta

I think the excess space at the top comes from space remaining after the picture is “moved” to the header of the blogpost, resulting not in space below gained, but being empty.

But I noticed an actual problem: If I post links to such a blog post in other topics, there is no thumbnail, see here

1 me gusta

Here is a screenshot of what I mean:

2 Me gusta

I’m fairly sure this is due to you excluding a line break between the image upload link and the first paragraph. Can you try editing it to match the following:

![spagh|690x390](upload://nVi42gGIwt03DAYSzVEc4RvwS6h.jpeg) 

<big>While</big> there is ample space around the web to post and blog and share and tweet and all that, my favorite place to exchange ideas with all of you on the spaghetti western is this forum. Some of you might remember an effort dating back several years ago, it was called "Planet Spaghetti Western", and the idea was to have a blog, that would automatically aggregate posts from all the spaghetti western blogs around the internet, and present them sort of as a digest. It was rather complicated from a technical perspective and in the end more work than it was worth so I had to shut that down.

If that works, I’ll add a note in the OP about that requirement.

3 Me gusta

Hi. That reduces the margin a bit, indeed, thank you. I had done the exact opposite in the editor: leave as little space between the image and the beginning of the text

1 me gusta