Skip to content

Commit 16b24e6

Browse files
committed
Fix art gallery with simpler, working search terms
Issue identified: Complex search terms like 'Monet OR Renoir' were returning artworks without publicly available images, even with hasImages=true. Solution: - Use simpler, broader search terms that work reliably with hasImages=true - 'painting' for Impressionist Masters (instead of specific artist names) - 'Renaissance' for Renaissance Art - 'sculpture' for Ancient Art - 'American', 'Asian', 'modern' for other collections This approach mirrors the working simple version provided by user and ensures artworks with actual displayable images are returned from the Met Museum API.
1 parent 0a85c21 commit 16b24e6

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

art.html

Lines changed: 9 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
166+
// Collection configurations with working search terms
167167
const collections = {
168168
impressionist: {
169169
title: 'Impressionist Masters',
170170
description: 'Pioneers of light, color, and modern art',
171-
search: 'Monet OR Renoir OR Degas OR Pissarro OR Manet OR Cezanne',
171+
search: 'painting',
172172
icon: 'fas fa-brush'
173173
},
174174
renaissance: {
175175
title: 'Renaissance Art',
176176
description: 'Masterpieces from the rebirth of classical art',
177-
search: 'Renaissance OR Raphael OR Leonardo OR Michelangelo OR Botticelli',
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: 'Greek OR Roman OR Egyptian OR Ancient OR sculpture',
183+
search: 'sculpture',
184184
icon: 'fas fa-landmark'
185185
},
186186
american: {
187187
title: 'American Art',
188188
description: 'Celebrating American artistic heritage',
189-
search: 'American OR "United States" OR "American painting"',
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: 'Chinese OR Japanese OR Korean OR Asian OR "East Asian"',
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: 'Picasso OR modern OR abstract OR contemporary',
201+
search: 'modern',
202202
icon: 'fas fa-shapes'
203203
}
204204
};
@@ -260,8 +260,8 @@ <h2 class="text-2xl font-light text-gray-800 mb-2">${collection.title}</h2>
260260
loadingIndicator.style.display = 'block';
261261
gallery.innerHTML = '';
262262

263-
// Search for artworks - remove hasImages=true as it's not reliable
264-
const searchUrl = `https://collectionapi.metmuseum.org/public/collection/v1/search?isHighlight=true&q=${encodeURIComponent(collection.search)}`;
263+
// Search for artworks with hasImages=true (works with simple search terms)
264+
const searchUrl = `https://collectionapi.metmuseum.org/public/collection/v1/search?isHighlight=true&hasImages=true&q=${encodeURIComponent(collection.search)}`;
265265
const response = await fetchWithTimeout(searchUrl);
266266

267267
if (!response.ok) {

0 commit comments

Comments
 (0)