Skip to content

Commit 4267d22

Browse files
committed
Fix collection-specific search - now each category shows different artworks
PROBLEM IDENTIFIED: All collections were using the same hardcoded search query ('painting'), so every category displayed identical results. FIXES: - Use collection-specific search terms from the collections object - Update collections to use unique search terms: 'impressionist', 'renaissance', 'ancient', etc. - Add proper URL encoding for search queries - Add console logging to show which search term is being used NOW EACH COLLECTION WILL SHOW DIFFERENT ARTWORKS: - Impressionist Masters → search: 'impressionist' - Renaissance Art → search: 'renaissance' - Ancient Art → search: 'ancient' - American Art → search: 'american' - Asian Art → search: 'asian' - Modern Art → search: 'modern' This resolves the issue where all categories showed the same paintings.
1 parent 2448669 commit 4267d22

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

art.html

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -163,42 +163,42 @@ <h2 class="text-2xl font-light text-gray-800 mb-2">Impressionist Masters</h2>
163163
const loadingIndicator = document.getElementById('loading-indicator');
164164
const collectionTitle = document.getElementById('collection-title');
165165

166-
// Collection configurations - using 'a' for all since it's proven to work
166+
// Collection configurations with unique search terms
167167
const collections = {
168168
impressionist: {
169169
title: 'Impressionist Masters',
170170
description: 'Pioneers of light, color, and modern art',
171-
search: 'a',
171+
search: 'impressionist',
172172
icon: 'fas fa-brush'
173173
},
174174
renaissance: {
175175
title: 'Renaissance Art',
176176
description: 'Masterpieces from the rebirth of classical art',
177-
search: 'a',
177+
search: 'renaissance',
178178
icon: 'fas fa-church'
179179
},
180180
ancient: {
181181
title: 'Ancient Civilizations',
182182
description: 'Treasures from Greek, Roman, and Egyptian cultures',
183-
search: 'a',
183+
search: 'ancient',
184184
icon: 'fas fa-landmark'
185185
},
186186
american: {
187187
title: 'American Art',
188188
description: 'Celebrating American artistic heritage',
189-
search: 'a',
189+
search: 'american',
190190
icon: 'fas fa-flag-usa'
191191
},
192192
asian: {
193193
title: 'Asian Art',
194194
description: 'Rich traditions from across Asia',
195-
search: 'a',
195+
search: 'asian',
196196
icon: 'fas fa-torii-gate'
197197
},
198198
modern: {
199199
title: 'Modern & Contemporary',
200200
description: 'Innovative works from the 20th century onwards',
201-
search: 'a',
201+
search: 'modern',
202202
icon: 'fas fa-shapes'
203203
}
204204
};
@@ -325,8 +325,13 @@ <h2 class="text-2xl font-light text-gray-800 mb-2">${collection.title}</h2>
325325

326326
console.log(`🔄 Fetching fresh ${collectionKey} artworks from Met Museum API...`);
327327

328-
// Ultra-simple API call - no complex batching
329-
const searchResponse = await fetch('https://collectionapi.metmuseum.org/public/collection/v1/search?isHighlight=true&hasImages=true&q=painting', {
328+
// Use collection-specific search terms
329+
const collection = collections[collectionKey];
330+
const searchQuery = collection.search || 'painting';
331+
332+
console.log(`🔍 Searching for: '${searchQuery}'`);
333+
334+
const searchResponse = await fetch(`https://collectionapi.metmuseum.org/public/collection/v1/search?isHighlight=true&hasImages=true&q=${encodeURIComponent(searchQuery)}`, {
330335
headers: { 'Accept': 'application/json' }
331336
});
332337

0 commit comments

Comments
 (0)