From e4e55deed42ce2d5163ddd1187b18e127ae614aa Mon Sep 17 00:00:00 2001 From: Hossein Mehrabi Date: Thu, 7 Dec 2023 03:56:24 +0330 Subject: [PATCH] fix: fix OG URLs --- src/pages/article/[...path].tsx | 7 +------ src/pages/podcasts/[showSlug]/[...path].tsx | 9 ++------- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/src/pages/article/[...path].tsx b/src/pages/article/[...path].tsx index 0190fa5..f4a7e7a 100644 --- a/src/pages/article/[...path].tsx +++ b/src/pages/article/[...path].tsx @@ -1,7 +1,6 @@ import { SEO } from '@/components/SEO' import ArticleContainer from '@/containers/ArticleContainer' import { GetStaticPropsContext } from 'next' -import { useRouter } from 'next/router' import unbodyApi from '../../services/unbody/unbody.service' import { LPE } from '../../types/lpe.types' @@ -12,10 +11,6 @@ type ArticleProps = { } const ArticlePage = ({ data, errors, why }: ArticleProps) => { - const { - query: { slug }, - } = useRouter() - if (!data) return null if (errors) return
{errors}
@@ -26,7 +21,7 @@ const ArticlePage = ({ data, errors, why }: ArticleProps) => { description={data.data.summary} noIndex={data.data.isDraft} image={data.data.coverImage} - pagePath={`/article/${slug}`} + pagePath={`/article/${data.data.slug}`} date={data.data.createdAt} tags={[ ...data.data.tags, diff --git a/src/pages/podcasts/[showSlug]/[...path].tsx b/src/pages/podcasts/[showSlug]/[...path].tsx index 4211e96..84714f4 100644 --- a/src/pages/podcasts/[showSlug]/[...path].tsx +++ b/src/pages/podcasts/[showSlug]/[...path].tsx @@ -1,7 +1,6 @@ import { SEO } from '@/components/SEO' import EpisodeContainer from '@/containers/EpisodeContainer' import { GetStaticPropsContext } from 'next' -import { useRouter } from 'next/router' import { LPE } from '../../../types/lpe.types' import unbodyApi from '@/services/unbody/unbody.service' @@ -14,10 +13,6 @@ type EpisodeProps = { } const EpisodePage = ({ episode, relatedEpisodes, errors }: EpisodeProps) => { - const { - query: { showSlug, epSlug }, - } = useRouter() - if (!episode) return null if (errors) return
{errors}
@@ -30,8 +25,8 @@ const EpisodePage = ({ episode, relatedEpisodes, errors }: EpisodeProps) => { image={episode.coverImage} imageUrl={undefined} pagePath={getPostLink('podcast', { - showSlug: showSlug as string, - postSlug: epSlug as string, + showSlug: episode.show?.slug as string, + postSlug: episode.slug as string, })} tags={[ ...episode.tags,