Skip to content

Commit c4958f4

Browse files
authored
add canonical urls (#1216)
* add meta image * add canonical urls * prettier
1 parent bce7abd commit c4958f4

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

dapp/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,5 @@ abis/*
5656

5757
# if you use npm instead of yarn do not commit the lock file to git because it can break the Google App Engine build
5858
package-lock.json
59+
60+
.env

dapp/pages/_app.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React, { useEffect, useState } from 'react'
22
import cookies from 'next-cookies'
33
import { useWeb3React } from '@web3-react/core'
44
import { useRouter } from 'next/router'
5+
import Head from 'next/head'
56
import { useCookies } from 'react-cookie'
67
import { useStoreState } from 'pullstate'
78
import { QueryClient, QueryClientProvider } from 'react-query'
@@ -59,6 +60,10 @@ function App({ Component, pageProps, err }) {
5960
const tried = useEagerConnect()
6061
const address = useStoreState(AccountStore, (s) => s.address)
6162

63+
const canonicalUrl = (
64+
`https://app.ousd.com` + (router.asPath === '/' ? '' : router.asPath)
65+
).split('?')[0]
66+
6267
if (process.browser) {
6368
useEffect(() => {
6469
router.events.on('routeChangeComplete', (url) => {
@@ -165,6 +170,9 @@ function App({ Component, pageProps, err }) {
165170

166171
return (
167172
<>
173+
<Head>
174+
<link rel="canonical" href={canonicalUrl} />
175+
</Head>
168176
<QueryClientProvider client={queryClient}>
169177
<AnalyticsProvider instance={analytics}>
170178
<AccountListener />

dapp/pages/_document.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ class MyDocument extends Document {
3939
type="text/javascript"
4040
></script>
4141

42+
<meta
43+
name="image"
44+
content={
45+
'https://cmsmediaproduction.s3.amazonaws.com/meta_9121c5630d.jpeg'
46+
}
47+
/>
4248
<meta property="og:url" content="https://ousd.com" />
4349
<meta property="og:type" content="website" />
4450
<meta property="og:title" content="Origin Dollar (OUSD)" />

0 commit comments

Comments
 (0)