Skip to content

Commit

Permalink
add next-seo
Browse files Browse the repository at this point in the history
  • Loading branch information
yousefomar724 committed Jun 26, 2022
1 parent a658cb9 commit d0c8993
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 16 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"i18next-http-backend": "^1.4.1",
"interweave": "^13.0.0",
"next": "12.1.6",
"next-seo": "^5.4.0",
"react": "18.2.0",
"react-bootstrap": "^2.4.0",
"react-dom": "18.2.0",
Expand Down
7 changes: 3 additions & 4 deletions pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default function Home() {
const { data: adsBanners } = useSWR('/ads-banner.php')
return (
<div>
{/* <Head>
<Head>
<link rel='icon' type='image/svg+xml' href='%PUBLIC_URL%/logo.svg' />
<link
rel='icon'
Expand Down Expand Up @@ -108,9 +108,8 @@ export default function Home() {
? window.dataLayer.push(arguments)
: null}
gtag('js', new Date()) gtag('config', 'G-XRGSDPNWJX')
</script>
</Head> */}
<SEO title='home title' description='home description' />
</script> */}
</Head>
<Header111 />
<ScrollToTop />
<main>
Expand Down
70 changes: 58 additions & 12 deletions pages/post/[id].js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useEffect, useState } from 'react'
// import { useParams } from 'react-router-dom'
import { NextSeo } from 'next-seo'
import useSWR from 'swr'
import { Card } from 'react-bootstrap'
import { useTranslation } from 'react-i18next'
Expand Down Expand Up @@ -70,15 +71,62 @@ const SinglePostPage = () => {
return (
<>
{post && (
// <SEO
// title={post.post_title.trim()}
// description={`${post.post_body.substring(3, 120)}...`}
// imageUrl={post.post_image}
// ogType='article'
// articleTag={post.post_category}
// />
<NextSeo
title={
post.post_title.trim()
? `${post.post_title.trim()} | ${baseTitle}`
: baseTitle
}
description={
`${post.post_body.substring(3, 120)}...`
? `${post.post_body.substring(3, 120)}...`
: DEFAULT_DESCRIPTION
}
openGraph={{
url: typeof window !== 'undefined' ? window.location.href : '/',
title: post.post_title.trim()
? `${post.post_title.trim()} | ${baseTitle}`
: baseTitle,
description: `${post.post_body.substring(3, 120)}...`
? `${post.post_body.substring(3, 120)}...`
: DEFAULT_DESCRIPTION,
images: [
{
url: post.post_image
? post.post_image
: `${
typeof window !== 'undefined' ? window.location.href : '/'
}syria-exchange-share.jpg`,
width: 800,
height: 600,
alt: 'Og Image Alt',
type: 'image/jpg',
},
{
url: 'https://syria-exchange.com/syria-exchange-share.jpg',
width: 900,
height: 800,
alt: 'Og Image Alt Second',
type: 'image/jpg',
},
],
site_name: 'https://syria-exchange-next.vercel.app/',
}}
twitter={{
// handle: '@handle',
// site: '@site',
cardType: 'summary_large_image',
}}
/>
)}
{/* <SEO title={post.post_title.trim()}
description={`${post.post_body.substring(3, 120)}...`}
imageUrl={post.post_image}
ogType='article'
articleTag={post.post_category}
/> */}

<Head>
{/* <Head>
<title>
{post.post_title.trim()
? `${post.post_title.trim()} | ${baseTitle}`
Expand Down Expand Up @@ -126,9 +174,7 @@ const SinglePostPage = () => {
/>
<meata property='og:locale' content='ar_AR' />
{/* {ogType === 'article' && articleTag && ( */}
<meta property='article:tag' content='article' />
{/* // )} */}
<meta property='twitter:card' content='summary_large_image' />
<meta
Expand All @@ -149,8 +195,8 @@ const SinglePostPage = () => {
}syria-exchange-share.jpg`
}
/>
</Head>
)}
</Head> */}

<Header111 />
<ScrollToTop />
<div className='mainPage container'>
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6348,6 +6348,11 @@ neo-async@^2.6.2:
resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f"
integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==

next-seo@^5.4.0:
version "5.4.0"
resolved "https://registry.yarnpkg.com/next-seo/-/next-seo-5.4.0.tgz#37a7784b30b3f70cec3fa0d77f9dde5990822d24"
integrity sha512-R9DhajPwJnR/lsF2hZ8cN8uqr5CVITsRrCG1AF5+ufcaybKYOvnH8sH9MaH4/hpkps3PQ9H71S7J7SPYixAYzQ==

next@12.1.6:
version "12.1.6"
resolved "https://registry.yarnpkg.com/next/-/next-12.1.6.tgz#eb205e64af1998651f96f9df44556d47d8bbc533"
Expand Down

1 comment on commit d0c8993

@vercel
Copy link

@vercel vercel bot commented on d0c8993 Jun 26, 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.