fix post-page rkey

This commit is contained in:
2025-06-15 21:15:35 +09:00
parent d4d98e2e91
commit 619675b551
6 changed files with 38 additions and 58 deletions

View File

@ -62,11 +62,15 @@ function generateBaseCollectionFromHost(host: string): string {
}
// Extract rkey from current URL
// /posts/xxx -> xxx
// /posts/xxx -> xxx (remove .html if present)
function extractRkeyFromUrl(): string | undefined {
const pathname = window.location.pathname;
const match = pathname.match(/\/posts\/([^/]+)\/?$/);
return match ? match[1] : undefined;
if (match) {
// Remove .html extension if present
return match[1].replace(/\.html$/, '');
}
return undefined;
}
// Get application configuration from environment variables