@@ -11,9 +11,10 @@ import axios from '../../utils/axios'
1111
1212interface SessionPageProp {
1313 session : SessionProp
14+ fullUrl : string
1415}
1516
16- const Session : NextPage < SessionPageProp > = ( { session } ) => {
17+ const Session : NextPage < SessionPageProp > = ( { session, fullUrl } ) => {
1718 const router = useRouter ( )
1819
1920 const navBackLink = router . query ?. from ? router . query ?. from : '/sessions'
@@ -27,6 +28,8 @@ const Session: NextPage<SessionPageProp> = ({ session }) => {
2728 < Head >
2829 < meta name = "twitter:image" content = { image } />
2930 < meta property = "og:image" content = { image } />
31+ < meta property = "og:url" content = { fullUrl } />
32+ < meta name = "twitter:url" content = { fullUrl } />
3033 </ Head >
3134 < div className = "w-full mt-10 lg:mt-20 xl:mt-10 mb-0" >
3235 < section className = "w-full bg-primary dark:bg-black-dark" >
@@ -78,6 +81,15 @@ export async function getServerSideProps({
7881 res,
7982 } ) } `
8083
84+ // Get protocol
85+ const protocol = req . headers [ 'x-forwarded-proto' ] || 'https'
86+ // Get host (includes domain and port)
87+ const { host } = req . headers
88+ // Get path
89+ const urlPath = req . url
90+ // Full URL
91+ const fullUrl = `${ protocol } ://${ host } ${ urlPath } `
92+
8193 const session = await axios
8294 . get ( `/events/${ process . env . NEXT_PUBLIC_EVENT_SLUG } /schedule/${ slug } ` )
8395 . then ( ( response ) => {
@@ -94,6 +106,6 @@ export async function getServerSideProps({
94106 notFound : true ,
95107 }
96108 }
97- return { props : { session } }
109+ return { props : { session, fullUrl } }
98110}
99111export default Session
0 commit comments