Fix search result links to include version in URL - ensures clicking search results navigates to correct Bible translation
This commit is contained in:
@@ -84,7 +84,8 @@ const SearchComponent: React.FC<SearchComponentProps> = ({
|
|||||||
const handleResultClick = (result: SearchResult) => {
|
const handleResultClick = (result: SearchResult) => {
|
||||||
const urlBookName = getBookUrlName(formatBookName(result.book));
|
const urlBookName = getBookUrlName(formatBookName(result.book));
|
||||||
// Navigate to chapter with verse hash to scroll directly to the verse
|
// Navigate to chapter with verse hash to scroll directly to the verse
|
||||||
const url = `/book/${urlBookName}/chapter/${result.chapter}#verse-${result.verse}`;
|
// Include the version in the URL to ensure we navigate to the correct translation
|
||||||
|
const url = `/version/${selectedVersion}/book/${urlBookName}/chapter/${result.chapter}#verse-${result.verse}`;
|
||||||
navigate(url);
|
navigate(url);
|
||||||
if (onClose) onClose();
|
if (onClose) onClose();
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user