@@ -278,7 +278,43 @@ <h1>Tech Briefs & News</h1>
278278
279279 < a href ="{{ post.url | relative_url }} " class ="news-card " data-title ="{{ post.title | downcase }} " data-category ="{{ post_cat }} ">
280280 < div style ="display: flex; flex-direction: column; height: 100%; ">
281- {% include news-thumb.html post=post %}
281+ {% assign t = post %}
282+ {% assign thumb = t.icon | default: t.image %}
283+ {% assign is_icon = false %}
284+ {% if t.icon %}{% assign is_icon = true %}{% endif %}
285+
286+ {% if thumb == blank %}
287+ {% if t.content contains '< img ' %}
288+ {% assign thumb = t.content | split: '< img ' | second | split: 'src="' | second | split: '"' | first %}
289+ {% elsif t.content contains '' | first %}
291+ {% endif %}
292+ {% endif %}
293+
294+ {% assign cat = t.category | default: "brief" | downcase %}
295+ {% case cat %}
296+ {% when "hardware" %}{% assign emoji = "💻" %}
297+ {% when "homelab" %}{% assign emoji = "🗄️" %}
298+ {% when "mikrotik", "sieć", "siec", "network" %}{% assign emoji = "🌐" %}
299+ {% when "proxmox" %}{% assign emoji = "🖥️" %}
300+ {% when "cisco" %}{% assign emoji = "🔌" %}
301+ {% else %}{% assign emoji = "⚡" %}
302+ {% endcase %}
303+
304+ < div class ="news-thumb ">
305+ {% if thumb != blank %}
306+ {% assign thumb_src = thumb %}
307+ {% unless thumb contains '://' %}
308+ {% assign thumb_src = thumb | relative_url %}
309+ {% endunless %}
310+ < img src ="{{ thumb_src }} " alt ="" loading ="lazy "
311+ class ="news-thumb-img {% if is_icon %}is-icon{% endif %} "
312+ onerror ="this.style.display='none'; this.nextElementSibling.style.display='flex'; ">
313+ < span class ="news-thumb-fallback " style ="display:none "> {{ emoji }}</ span >
314+ {% else %}
315+ < span class ="news-thumb-fallback "> {{ emoji }}</ span >
316+ {% endif %}
317+ </ div >
282318 < div class ="news-card-content ">
283319 < div >
284320 < div class ="news-card-meta ">
0 commit comments