fix: fix OG URLs

This commit is contained in:
Hossein Mehrabi 2023-12-07 03:56:24 +03:30
parent 795ad26e40
commit e4e55deed4
No known key found for this signature in database
GPG Key ID: 45C04964191AFAA1
2 changed files with 3 additions and 13 deletions

View File

@ -1,7 +1,6 @@
import { SEO } from '@/components/SEO' import { SEO } from '@/components/SEO'
import ArticleContainer from '@/containers/ArticleContainer' import ArticleContainer from '@/containers/ArticleContainer'
import { GetStaticPropsContext } from 'next' import { GetStaticPropsContext } from 'next'
import { useRouter } from 'next/router'
import unbodyApi from '../../services/unbody/unbody.service' import unbodyApi from '../../services/unbody/unbody.service'
import { LPE } from '../../types/lpe.types' import { LPE } from '../../types/lpe.types'
@ -12,10 +11,6 @@ type ArticleProps = {
} }
const ArticlePage = ({ data, errors, why }: ArticleProps) => { const ArticlePage = ({ data, errors, why }: ArticleProps) => {
const {
query: { slug },
} = useRouter()
if (!data) return null if (!data) return null
if (errors) return <div>{errors}</div> if (errors) return <div>{errors}</div>
@ -26,7 +21,7 @@ const ArticlePage = ({ data, errors, why }: ArticleProps) => {
description={data.data.summary} description={data.data.summary}
noIndex={data.data.isDraft} noIndex={data.data.isDraft}
image={data.data.coverImage} image={data.data.coverImage}
pagePath={`/article/${slug}`} pagePath={`/article/${data.data.slug}`}
date={data.data.createdAt} date={data.data.createdAt}
tags={[ tags={[
...data.data.tags, ...data.data.tags,

View File

@ -1,7 +1,6 @@
import { SEO } from '@/components/SEO' import { SEO } from '@/components/SEO'
import EpisodeContainer from '@/containers/EpisodeContainer' import EpisodeContainer from '@/containers/EpisodeContainer'
import { GetStaticPropsContext } from 'next' import { GetStaticPropsContext } from 'next'
import { useRouter } from 'next/router'
import { LPE } from '../../../types/lpe.types' import { LPE } from '../../../types/lpe.types'
import unbodyApi from '@/services/unbody/unbody.service' import unbodyApi from '@/services/unbody/unbody.service'
@ -14,10 +13,6 @@ type EpisodeProps = {
} }
const EpisodePage = ({ episode, relatedEpisodes, errors }: EpisodeProps) => { const EpisodePage = ({ episode, relatedEpisodes, errors }: EpisodeProps) => {
const {
query: { showSlug, epSlug },
} = useRouter()
if (!episode) return null if (!episode) return null
if (errors) return <div>{errors}</div> if (errors) return <div>{errors}</div>
@ -30,8 +25,8 @@ const EpisodePage = ({ episode, relatedEpisodes, errors }: EpisodeProps) => {
image={episode.coverImage} image={episode.coverImage}
imageUrl={undefined} imageUrl={undefined}
pagePath={getPostLink('podcast', { pagePath={getPostLink('podcast', {
showSlug: showSlug as string, showSlug: episode.show?.slug as string,
postSlug: epSlug as string, postSlug: episode.slug as string,
})} })}
tags={[ tags={[
...episode.tags, ...episode.tags,