Skip to content

Commit d5ab520

Browse files
authored
Update blog.html
1 parent 8e51127 commit d5ab520

1 file changed

Lines changed: 7 additions & 12 deletions

File tree

‎blog.html‎

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
padding: 50px 40px !important;
1010
}
1111

12-
/* NAGŁÓWEK SEKCJI */
1312
.blog-header {
1413
margin-bottom: 40px;
1514
border-bottom: 1px solid var(--border);
@@ -28,7 +27,6 @@
2827
font-family: 'JetBrains Mono', monospace;
2928
}
3029

31-
/* PANEL STEROWANIA: FILTRY I WYSZUKIWARKA */
3230
.blog-controls {
3331
display: flex;
3432
justify-content: space-between;
@@ -86,7 +84,6 @@
8684
box-shadow: 0 0 15px rgba(0, 210, 255, 0.15);
8785
}
8886

89-
/* SIATKA / LISTA WPISÓW TECHNICZNYCH */
9087
.posts-container {
9188
display: flex;
9289
flex-direction: column;
@@ -179,14 +176,14 @@ <h1 class="blog-title">Dziennik Inżynieryjny / Blog</h1>
179176
<div class="blog-subtitle">// REJESTR ZMIAN, KONFIGURACJI I WDROŻEŃ W HOMELABIE</div>
180177
</div>
181178

182-
<!-- PANEL FILTRÓW I WYSZUKIWARKI -->
179+
<!-- PANEL FILTRÓW GENEROWANY DYNAMICZNIE Z POSTÓW + WYSZUKIWARKA -->
183180
<div class="blog-controls">
184181
<div class="filter-group" id="categoryFilters">
185182
<button class="filter-btn active" data-filter="all">Wszystkie</button>
186-
<button class="filter-btn" data-filter="homelab">Homelab</button>
187-
<button class="filter-btn" data-filter="networking">Networking</button>
188-
<button class="filter-btn" data-filter="hardware">Hardware</button>
189-
<button class="filter-btn" data-filter="code">Code & Apps</button>
183+
{% assign raw_categories = site.posts | map: "category" | compact | uniq %}
184+
{% for cat in raw_categories %}
185+
<button class="filter-btn" data-filter="{{ cat | downcase }}">{{ cat | upcase }}</button>
186+
{% endfor %}
190187
</div>
191188
<div>
192189
<input type="text" id="searchInput" class="search-input" placeholder="Szukaj we wpisach...">
@@ -210,15 +207,14 @@ <h1 class="blog-title">Dziennik Inżynieryjny / Blog</h1>
210207
{% endfor %}
211208
</div>
212209

213-
<!-- SKRYPT DO FILTROWANIA I WYSZUKIWANIA W CZASIE RZECZYWISTYM -->
210+
<!-- SKRYPT DO FILTROWANIA I WYSZUKIWANIA -->
214211
<script>
215212
const filterBtns = document.querySelectorAll('.filter-btn');
216213
const searchInput = document.getElementById('searchInput');
217214
const postCards = document.querySelectorAll('.post-card');
218215

219216
let currentCategory = 'all';
220217

221-
// Obsługa kliknięcia filtrów kategorii
222218
filterBtns.forEach(btn => {
223219
btn.addEventListener('click', () => {
224220
filterBtns.forEach(b => b.classList.remove('active'));
@@ -228,7 +224,6 @@ <h1 class="blog-title">Dziennik Inżynieryjny / Blog</h1>
228224
});
229225
});
230226

231-
// Obsługa wyszukiwarki
232227
searchInput.addEventListener('input', () => {
233228
filterPosts();
234229
});
@@ -240,7 +235,7 @@ <h1 class="blog-title">Dziennik Inżynieryjny / Blog</h1>
240235
const category = card.getAttribute('data-category');
241236
const title = card.getAttribute('data-title');
242237

243-
const matchesCategory = (currentCategory === 'all' || category.includes(currentCategory));
238+
const matchesCategory = (currentCategory === 'all' || category === currentCategory);
244239
const matchesSearch = title.includes(query);
245240

246241
if (matchesCategory && matchesSearch) {

0 commit comments

Comments
 (0)