Skip to content

Commit

Permalink
Merge pull request #175 from prezly/feature/qrf-9-error-with-dynamic-…
Browse files Browse the repository at this point in the history
…hrefs-on-search-page

[QRF-9] Error with dynamic hrefs on search page
  • Loading branch information
fgyimah authored Aug 19, 2022
2 parents fa60bdc + 78e14ba commit d0972f5
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions modules/Search/components/Hit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,15 @@ function HitComponent({ hit }: Props) {
const { categories } = story;
const { showDate, showSubtitle } = useThemeSettings();

// strip query params from story links
const storyLink = {
pathname: '/[slug]',
query: { slug: story.slug },
};

return (
<div className={classNames(cardStyles.container, cardStyles.small)}>
<Link href={`/${story.slug}`} locale={false} passHref>
<Link href={storyLink} locale={false} passHref>
<a className={cardStyles.imageWrapper}>
<StoryImage
story={story}
Expand All @@ -41,7 +47,7 @@ function HitComponent({ hit }: Props) {
</div>
)}
<h3 className={classNames(cardStyles.title, cardStyles.titleSmaller)}>
<Link href={`/${story.slug}`} locale={false} passHref>
<Link href={storyLink} locale={false} passHref>
<a className={classNames(cardStyles.titleLink, styles.title)}>
<Highlight hit={hit} attribute="attributes.title" tagName="mark" />
</a>
Expand All @@ -50,7 +56,7 @@ function HitComponent({ hit }: Props) {

{showSubtitle && (
<p className={cardStyles.subtitle}>
<Link href={`/${story.slug}`} locale={false} passHref>
<Link href={storyLink} locale={false} passHref>
<a className={cardStyles.titleLink}>{story.subtitle}</a>
</Link>
</p>
Expand Down

3 comments on commit d0972f5

@vercel
Copy link

@vercel vercel bot commented on d0972f5 Aug 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on d0972f5 Aug 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on d0972f5 Aug 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.