feat: implement SEO-friendly URLs for Bible reader

- Add dynamic route structure /[locale]/bible/[version]/[book]/[chapter]
- Convert UUID-based URLs to readable format (e.g., /en/bible/eng-kjv/genesis/1)
- Implement automatic redirects from old URLs to new SEO-friendly format
- Add SEO metadata generation with proper titles, descriptions, and OpenGraph tags
- Create API endpoint for URL conversion between formats
- Update navigation in search results, bookmarks, and internal links
- Fix PWA manifest icons to correct dimensions (192x192, 512x512)
- Resolve JavaScript parameter passing issues between server and client components
- Maintain backward compatibility with existing bookmark and search functionality

Benefits:
- Improved SEO with descriptive URLs
- Better user experience with readable URLs
- Enhanced social media sharing
- Maintained full backward compatibility
This commit is contained in:
2025-09-28 23:17:58 +00:00
parent a01b2490dc
commit 61a5180e2f
10 changed files with 435 additions and 19 deletions

View File

@@ -116,7 +116,38 @@ export default function BookmarksPage() {
}
}
const handleNavigateToBookmark = (bookmark: BookmarkItem) => {
const handleNavigateToBookmark = async (bookmark: BookmarkItem) => {
try {
// Try to generate SEO-friendly URL
const response = await fetch('/api/bible/seo-url', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
versionId: bookmark.navigation.versionId,
bookId: bookmark.navigation.bookId,
chapter: bookmark.navigation.chapterNum.toString(),
locale
})
})
if (response.ok) {
const data = await response.json()
if (data.success && data.seoUrl) {
let url = data.seoUrl
if (bookmark.navigation.verseNum) {
url += `?verse=${bookmark.navigation.verseNum}`
}
router.push(url)
return
}
}
} catch (error) {
console.error('Error generating SEO URL:', error)
}
// Fallback to old URL format
const params = new URLSearchParams({
book: bookmark.navigation.bookId,
chapter: bookmark.navigation.chapterNum.toString(),