diff --git a/src/components/wallpaper.astro b/src/components/wallpaper.astro index 81e1a0c..69158bc 100644 --- a/src/components/wallpaper.astro +++ b/src/components/wallpaper.astro @@ -4,6 +4,11 @@ import wallpapers from "../../public/wallpapers.json"; const wallpaper = wallpapers[Math.floor(Math.random() * wallpapers.length)]; +// Get first part of location +const [location1, ...locationRest] = wallpaper.location.split(","); + +// Get rest of location +const location2 = locationRest.join(","); ---
- {wallpaper.location} + {location1}
diff --git a/utils/wallpapers.ts b/utils/wallpapers.ts index d9a01cf..2435854 100644 --- a/utils/wallpapers.ts +++ b/utils/wallpapers.ts @@ -38,8 +38,9 @@ for await (const dirEntry of Deno.readDir(imagesPath)) { const date = dateObject.toISOString().split("T")[0]; // Http request to get location + // Documentation: https://nominatim.org/release-docs/develop/api/Reverse/ const response = await fetch( - `https://nominatim.openstreetmap.org/reverse?format=json&lat=${exif.latitude}&lon=${exif.longitude}&zoom=5`, + `https://nominatim.openstreetmap.org/reverse?format=json&lat=${exif.latitude}&lon=${exif.longitude}&zoom=8`, { headers: { "User-Agent": "https://philippeloctaux.com" } } ); const data = await response.json();