-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Try to fix SEO issues and add Vercel analytics and speed insigh…
…ts packages
- Loading branch information
1 parent
86965f9
commit 7b0a6b4
Showing
5 changed files
with
49 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,36 @@ | ||
/* eslint-disable react/jsx-props-no-spreading */ | ||
import type { AppProps } from 'next/app'; | ||
import React from 'react'; | ||
import Cookies from 'js-cookie'; | ||
import { getInitialLocale } from 'multilingual-url/lib'; | ||
import { Analytics } from '@vercel/analytics/react'; | ||
import { SpeedInsights } from '@vercel/speed-insights/next'; | ||
import { defaultLocale, locales } from '../src/constants/locales'; | ||
import '../src/styles/main.css'; | ||
|
||
function MyApp({ Component, pageProps }) { | ||
function MyApp({ Component, pageProps }: AppProps): JSX.Element { | ||
const hasLangCookie = Cookies.get('lang'); | ||
const locale = getInitialLocale(defaultLocale, locales); | ||
const hasDocument = typeof document !== 'undefined'; | ||
const htmlElement = hasDocument ? document.querySelector('html') : null; | ||
|
||
if (!hasLangCookie) { | ||
Cookies.set('lang', locale, { | ||
expires: 60, | ||
}); | ||
} | ||
|
||
if (hasDocument) { | ||
document.querySelector('html').lang = locale; // eslint-disable-line no-undef | ||
if (hasDocument && htmlElement) { | ||
htmlElement.lang = locale; // eslint-disable-line no-undef | ||
} | ||
|
||
return <Component {...pageProps} />; | ||
return ( | ||
<> | ||
<Component {...pageProps} /> | ||
<Analytics /> | ||
<SpeedInsights /> | ||
</> | ||
); | ||
} | ||
|
||
export default MyApp; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1351,13 +1351,6 @@ | |
dependencies: | ||
"@babel/types" "^7.3.0" | ||
|
||
"@types/classnames@^2.3.1": | ||
version "2.3.1" | ||
resolved "https://registry.yarnpkg.com/@types/classnames/-/classnames-2.3.1.tgz#3c2467aa0f1a93f1f021e3b9bcf938bd5dfdc0dd" | ||
integrity sha512-zeOWb0JGBoVmlQoznvqXbE0tEC/HONsnoUNH19Hc96NFsTAwTXbTqb8FMYkru1F/iqp7a18Ws3nWJvtA1sHD1A== | ||
dependencies: | ||
classnames "*" | ||
|
||
"@types/dompurify@^3.0.2": | ||
version "3.0.2" | ||
resolved "https://registry.yarnpkg.com/@types/dompurify/-/dompurify-3.0.2.tgz#c1cd33a475bc49c43c2a7900e41028e2136a4553" | ||
|
@@ -1399,6 +1392,11 @@ | |
expect "^29.0.0" | ||
pretty-format "^29.0.0" | ||
|
||
"@types/js-cookie@^3.0.6": | ||
version "3.0.6" | ||
resolved "https://registry.yarnpkg.com/@types/js-cookie/-/js-cookie-3.0.6.tgz#a04ca19e877687bd449f5ad37d33b104b71fdf95" | ||
integrity sha512-wkw9yd1kEXOPnvEeEV1Go1MmxtBJL0RR79aOTAApecWFVu7w0NNXNqhcWgvw2YgZDYadliXkl14pa3WXw5jlCQ== | ||
|
||
"@types/jsdom@^20.0.0": | ||
version "20.0.1" | ||
resolved "https://registry.yarnpkg.com/@types/jsdom/-/jsdom-20.0.1.tgz#07c14bc19bd2f918c1929541cdaacae894744808" | ||
|
@@ -1516,13 +1514,6 @@ | |
resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.1.tgz#20f18294f797f2209b5f65c8e3b5c8e8261d127c" | ||
integrity sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw== | ||
|
||
"@types/styled-jsx@^3.4.4": | ||
version "3.4.4" | ||
resolved "https://registry.yarnpkg.com/@types/styled-jsx/-/styled-jsx-3.4.4.tgz#643b49a892f596ee8d8e588e0270d6c05947048d" | ||
integrity sha512-PRRa7gU7ske4Vs7sKWrqfKnuIIS6E/Yj5oKyxuM11AwOKhH9HlbQ7cKGLluXkOXzpEoDJE+6kQMj3AE34/JooQ== | ||
dependencies: | ||
styled-jsx "*" | ||
|
||
"@types/tough-cookie@*": | ||
version "4.0.2" | ||
resolved "https://registry.yarnpkg.com/@types/tough-cookie/-/tough-cookie-4.0.2.tgz#6286b4c7228d58ab7866d19716f3696e03a09397" | ||
|
@@ -1740,6 +1731,18 @@ | |
"@typescript-eslint/types" "6.6.0" | ||
eslint-visitor-keys "^3.4.1" | ||
|
||
"@vercel/analytics@^1.1.1": | ||
version "1.1.1" | ||
resolved "https://registry.yarnpkg.com/@vercel/analytics/-/analytics-1.1.1.tgz#2a712378a95014a548b4f9d2ae1ea0721433908d" | ||
integrity sha512-+NqgNmSabg3IFfxYhrWCfB/H+RCUOCR5ExRudNG2+pcRehq628DJB5e1u1xqwpLtn4pAYii4D98w7kofORAGQA== | ||
dependencies: | ||
server-only "^0.0.1" | ||
|
||
"@vercel/speed-insights@^1.0.3": | ||
version "1.0.3" | ||
resolved "https://registry.yarnpkg.com/@vercel/speed-insights/-/speed-insights-1.0.3.tgz#ae7175e2b9fd37f815519ff555d0eac4c7a0dfad" | ||
integrity sha512-bKIt0HDdF6hP2bJZyS+za3k6sKeAXNRLSIUbwVwvyvKdsHBWS6ILBvmD1wXHZZyTqjU1TP7dTE/F6lHM6rBdKA== | ||
|
||
abab@^2.0.6: | ||
version "2.0.6" | ||
resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.6.tgz#41b80f2c871d19686216b82309231cfd3cb3d291" | ||
|
@@ -2379,7 +2382,7 @@ cjs-module-lexer@^1.0.0: | |
resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-1.2.2.tgz#9f84ba3244a512f3a54e5277e8eef4c489864e40" | ||
integrity sha512-cOU9usZw8/dXIXKtwa8pM0OTJQuJkxMN6w30csNRUerHfeQ5R6U3kkU/FtJeIf3M202OHfY2U8ccInBG7/xogA== | ||
|
||
classnames@*, classnames@^2.3.2: | ||
classnames@^2.3.2: | ||
version "2.3.2" | ||
resolved "https://registry.yarnpkg.com/classnames/-/classnames-2.3.2.tgz#351d813bf0137fcc6a76a16b88208d2560a0d924" | ||
integrity sha512-CSbhY4cFEJRe6/GQzIk5qXZ4Jeg5pcsP7b5peFSDpffpe1cqjASH/n9UTjBwOp6XpMSTwQ8Za2K5V02ueA7Tmw== | ||
|
@@ -6816,6 +6819,11 @@ [email protected]: | |
parseurl "~1.3.3" | ||
send "0.18.0" | ||
|
||
server-only@^0.0.1: | ||
version "0.0.1" | ||
resolved "https://registry.yarnpkg.com/server-only/-/server-only-0.0.1.tgz#0f366bb6afb618c37c9255a314535dc412cd1c9e" | ||
integrity sha512-qepMx2JxAa5jjfzxG79yPPq+8BuFToHd1hm7kI+Z4zAq1ftQiP7HcxMhDDItrbtwVeLg/cY2JnKnrcFkmiswNA== | ||
|
||
set-blocking@^2.0.0: | ||
version "2.0.0" | ||
resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" | ||
|
@@ -7115,20 +7123,20 @@ styled-jsx-plugin-postcss@^4.0.1: | |
dependencies: | ||
postcss-load-config "^2.1.2" | ||
|
||
styled-jsx@*, styled-jsx@^5.1.2: | ||
version "5.1.2" | ||
resolved "https://registry.yarnpkg.com/styled-jsx/-/styled-jsx-5.1.2.tgz#55020c50da54d2b225750bd7aaab57d511724060" | ||
integrity sha512-FI5r0a5ED2/+DSdG2ZRz3a4FtNQnKPLadauU5v76a9QsscwZrWggQKOmyxGGP5EWKbyY3bsuWAJYzyKaDAVAcw== | ||
dependencies: | ||
client-only "0.0.1" | ||
|
||
[email protected]: | ||
version "5.1.1" | ||
resolved "https://registry.yarnpkg.com/styled-jsx/-/styled-jsx-5.1.1.tgz#839a1c3aaacc4e735fed0781b8619ea5d0009d1f" | ||
integrity sha512-pW7uC1l4mBZ8ugbiZrcIsiIvVx1UmTfw7UkC3Um2tmfUq9Bhk8IiyEIPl6F8agHgjzku6j0xQEZbfA5uSgSaCw== | ||
dependencies: | ||
client-only "0.0.1" | ||
|
||
styled-jsx@^5.1.2: | ||
version "5.1.2" | ||
resolved "https://registry.yarnpkg.com/styled-jsx/-/styled-jsx-5.1.2.tgz#55020c50da54d2b225750bd7aaab57d511724060" | ||
integrity sha512-FI5r0a5ED2/+DSdG2ZRz3a4FtNQnKPLadauU5v76a9QsscwZrWggQKOmyxGGP5EWKbyY3bsuWAJYzyKaDAVAcw== | ||
dependencies: | ||
client-only "0.0.1" | ||
|
||
supports-color@^5.3.0: | ||
version "5.5.0" | ||
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" | ||
|