Questo componente tema ti permetterà di designare una categoria di blog e modificherà l’aspetto e l’atmosfera di tutti i topic all’interno di quella categoria per assomigliare di più a un tradizionale post di blog. Si tratta essenzialmente di un adattamento in componente tema del plugin Blog post plugin .
Il codice immagine della tua immagine in evidenza dovrebbe essere la prima riga del post. Il componente “sposterà” quell’immagine sopra il titolo del topic per produrre l’effetto mostrato nell’immagine di esempio sopra. Assicurati di includere una riga vuota tra il codice immagine dell’immagine in evidenza e il contenuto successivo.
Puoi usare i tag <big></big> attorno alla prima lettera di una parola per creare un effetto iniziale
Potresti voler abilitare l’impostazione della categoria Naviga al primo post dopo che i topic sono stati letti per evidenziare sempre il post del blog quando si accede per la prima volta a un topic.
L’immagine principale è centrata all’interno dello spazio disponibile. Potrebbe essere necessario modificare la foto per visualizzarla come si desidera.
Dettagli aggiuntivi
L’altezza del contenitore dell’immagine del blog è 440px e la larghezza è il 100% del contenitore principale. L’immagine è centrata all’interno dello spazio disponibile, quindi se la tua immagine ha un’altezza di 500px, 30px verranno tagliati dalla parte superiore e 30px dalla parte inferiore. Il ritaglio orizzontale inizia a 1100px (la larghezza massima del contenuto principale su un sito Discourse) e aumenterà man mano che la finestra si restringe. Lo scenario ideale è utilizzare un’immagine che abbia un soggetto centralizzato, o uno che abbia un soggetto generalizzato come un motivo o una foto naturalistica come quella che mostro nel mio esempio.
Puoi applicare lo stile a più categorie. Ciò può essere fatto separando con virgole gli slug delle categorie, assicurandoti di omettere eventuali spazi prima o dopo le virgole. Le sottocategorie possono essere aggiunte seguendo questi passaggi:
Ottieni il link alla sottocategoria e isola la parte dopo /c/
https://meta.discourse.org/c/support/wordpress
Sostituisci / con un - in modo da ottenere support-wordpress
Aggiungi il risultato all’impostazione del tema
Quando crei per la prima volta il topic del post del blog, dovrai aggiornare la pagina per vedere l’immagine principale apparire sopra il contenuto. Questo accade solo subito dopo la pubblicazione e solo per l’autore del topic.
Suggerimenti su come migliorare il componente sono benvenuti. Non posso promettere che sarò in grado di aggiungere la funzionalità o apportare la modifica, ma sarà certamente presa in considerazione
Elenco attuale di cose da fare/richieste di funzionalità
Assicurarsi che il componente funzioni bene con DiscoToC (specialmente con RTL)
Consentire l’uso dei tag come modo per applicare lo stile a un post
Consentire l’uso di video oltre alle immagini
Un ringraziamento speciale a @simon e @awesomerobot per la grande ispirazione che il loro lavoro precedente ha fornito nella creazione di questo.
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
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 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.
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?
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.
Thank you for a really inspiring and nice component @tshenry
In my evaluation I have identified two issues;
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.
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.
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:
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.
Awesome, thank you @tshenry I can gladly confirm that both issues have been resolved with the update and again - thank you for a really great component, not only in function but inspiration as well
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.
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?
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
Thanks for the feedback 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!
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
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:

<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.
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