Slightly prettier analytics URL

This commit is contained in:
2026-08-21 23:58:00 +00:00
parent 6199e5a69e
commit 29f8fac013
3 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -196,8 +196,8 @@ with a "could not be loaded" message.
Because it is a real page, fetch-navigation handles it like any other internal
link: clicking the 📊 pen (or any link to `/_a`) fetches the server-rendered
HTML, swaps the dynamic regions and mounts the Vue analytics app in place. The
range selector updates the URL query string (`?range=week` etc.) so links to
a specific range can be shared.
range selector updates the URL hash (`#week` etc.) so links to a specific
range can be shared.
`AnalyticsView.vue` is no longer a full-screen overlay; the `body.analytics-open`
page-chrome hiding and `#/analytics/<range>` hash routing have been removed.
+1 -1
View File
@@ -87,7 +87,7 @@ const range = ref(RANGES[props.initialRange] ? props.initialRange : 'week')
// Keep the URL shareable when the range changes.
watch(range, (r) => {
const url = new URL(location.href)
url.searchParams.set('range', r)
url.hash = r
history.replaceState(null, '', url)
})
+1 -1
View File
@@ -9,7 +9,7 @@ let app = null
export function mount(container) {
if (app) return
app = createApp(AnalyticsView, {
initialRange: new URLSearchParams(location.search).get('range') || 'week',
initialRange: location.hash.slice(1) || 'week',
})
app.mount(container)
}