docs: add visitor map configuration to README and update docs.md

- Added visitor map section to README.md after GitHub Contributions Graph
- Updated visitor map description in content/pages/docs.md with privacy details
- Documents configuration options in src/config/siteConfig.ts
- Explains Netlify geo detection and theme-aware colors
This commit is contained in:
Wayne Sutton
2025-12-21 15:58:43 -08:00
parent 1e67e492c8
commit 4a912fd345
32 changed files with 1129 additions and 37 deletions

View File

@@ -0,0 +1,32 @@
import type { Context } from "@netlify/edge-functions";
// Returns the user's geo location from Netlify's automatic geo headers
// Privacy friendly: only returns city/country/coordinates, no IP address stored
export default async function handler(
_request: Request,
context: Context,
): Promise<Response> {
// Netlify provides geo data automatically via context.geo
const geo = context.geo;
const data = {
city: geo?.city || null,
country: geo?.country?.code || null,
countryName: geo?.country?.name || null,
latitude: geo?.latitude || null,
longitude: geo?.longitude || null,
};
return new Response(JSON.stringify(data), {
headers: {
"Content-Type": "application/json",
"Cache-Control": "private, max-age=3600",
"Access-Control-Allow-Origin": "*",
},
});
}
export const config = {
path: "/api/geo",
};