From cfb35a3c3837e4cc9458d81102e17c86e3c8e6b5 Mon Sep 17 00:00:00 2001 From: Jonas Raneryd Imaizumi Date: Sun, 25 Jan 2026 23:37:20 +0100 Subject: [PATCH] Add badge filtering and shop category to the site - Introduced a new 'shops' category in the build script and README. - Implemented badge filtering in the filter functionality, allowing users to filter entries by badge. --- README.md | 11 ++++++---- build.js | 22 +++++++++++++++++-- content/shops/goteborg-manufaktur.md | 13 +++++++++++ public/filter.js | 20 ++++++++++++++++- static/images/goteborg-manufaktur-cover.jpeg | Bin 0 -> 253807 bytes static/images/goteborg-manufaktur.avif | Bin 0 -> 24371 bytes 6 files changed, 59 insertions(+), 7 deletions(-) create mode 100644 content/shops/goteborg-manufaktur.md create mode 100644 static/images/goteborg-manufaktur-cover.jpeg create mode 100644 static/images/goteborg-manufaktur.avif diff --git a/README.md b/README.md index a534337..047bd02 100644 --- a/README.md +++ b/README.md @@ -33,10 +33,13 @@ The generated site will be in the `dist/` folder. Create a Markdown file in the appropriate `content/` subfolder: -- `content/products/` - Swedish products -- `content/services/` - Swedish services -- `content/experiences/` - Swedish experiences -- `content/manufacturers/` - Swedish manufacturers +| Folder | Category | Description | +|--------|----------|-------------| +| `content/products/` | Produkter | Physical Swedish products (e.g., Dalahäst, Orrefors glass) | +| `content/manufacturers/` | Tillverkare | Companies that design/manufacture products (e.g., Fjällräven, Hasselblad) | +| `content/shops/` | Butiker | Retail stores selling products (e.g., Göteborg Manufaktur) | +| `content/services/` | Tjänster | Service providers, both physical and digital (e.g., SJ, Mediaflow) | +| `content/experiences/` | Upplevelser | Experiences, events, and cultural activities (e.g., Icehotel, Midsommar) | ### Content Format diff --git a/build.js b/build.js index 9c1766d..feb36d0 100644 --- a/build.js +++ b/build.js @@ -14,7 +14,8 @@ const CATEGORY_LABELS = { manufacturers: 'Tillverkare', products: 'Produkter', services: 'Tjänster', - experiences: 'Upplevelser' + experiences: 'Upplevelser', + shops: 'Butiker' }; // Badge tiers (highest to lowest) @@ -207,8 +208,14 @@ function extractFilters(entries) { const categories = [...new Set(entries.map(e => e.category).filter(Boolean))].sort(); const regions = [...new Set(entries.map(e => e.region).filter(Boolean))].sort(); const tags = [...new Set(entries.flatMap(e => e.tags || []))].sort(); + const badges = [...new Set(entries.map(e => e.badge).filter(Boolean))].sort((a, b) => { + // Sort by tier (highest first) + const tierA = BADGE_TIERS[a]?.tier || 99; + const tierB = BADGE_TIERS[b]?.tier || 99; + return tierA - tierB; + }); - return { categories, regions, tags }; + return { categories, regions, tags, badges }; } // Generate filter HTML @@ -224,6 +231,10 @@ function generateFilterHTML(filters) { const tagOptions = filters.tags.map(t => `` ).join(''); + + const badgeOptions = filters.badges.map(b => + `` + ).join(''); return `
@@ -241,6 +252,13 @@ function generateFilterHTML(filters) { ${regionOptions}
+
+ + +