Skip to content

Commit

Permalink
added social images
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher-Stevers committed Aug 2, 2023
1 parent d3c3e38 commit c9ee839
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
9 changes: 8 additions & 1 deletion pages/_app.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function OpenQ({ Component, pageProps }) {
const route = router.pathname;
const whiteBgRoutes = ['/drm', '/marketplace', '/hackathon-launchpad'];
const isWhiteBgRoute = whiteBgRoutes.includes(route);

const socialImage = pageProps?.page?.data?.socialimage.url;
return (
<>
{/* Global Site Tag (gtag.js) - Google Analytics */}
Expand All @@ -75,6 +75,13 @@ function OpenQ({ Component, pageProps }) {
<meta name='OpenQ Bounties' content='width=device-width, initial-scale=1.0' />
<link rel='icon' href='/openq-logo.png' />
<link rel='manifest' href='/manifest.json' crossOrigin='use-credentials' />

{socialImage && (
<>
<meta property='og:image' content={socialImage} />
<meta property='twitter:image' content={socialImage} />
</>
)}
</Head>
<Script id='live-session'>
{`window['__ls_namespace'] = 'LiveSession';
Expand Down
4 changes: 0 additions & 4 deletions pages/blog/[slug].jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,9 @@ import * as prismic from '@prismicio/client';
import { SliceZone } from '@prismicio/react';
import { components } from '../../slices';
import { createClient } from '../../prismicio';
import Head from 'next/head';
export default function Home({ page }) {
return (
<div className='flex flex-col items-center content-center'>
<Head>
<meta property='og:image' content={page?.data?.socialimage?.url} />
</Head>
{page?.data && <SliceZone slices={page.data.slices} components={components} />}
</div>
);
Expand Down

0 comments on commit c9ee839

Please sign in to comment.