You can use Edge Functions to get information about a user's location to serve location-specific content and personalize their experience.
Geolocation information is available on the Context.geo
object.
context: {
geo: {
city?: string;
country?: {
code?: string;
name?: string;
},
subdivision?: {
code?: string;
name?: string;
},
}
}
Edge Functions are files held in the netlify/edge-functions
directory.
You can deploy this and all the other examples in this repo as a site of your own to explore and experiment with, by clicking this button.