Skip to content

Commit e317312

Browse files
committed
Merge remote-tracking branch 'upstream/main'
2 parents 46d0bc3 + d8ca495 commit e317312

File tree

7 files changed

+51
-299
lines changed

7 files changed

+51
-299
lines changed
6.63 KB
Loading
7.12 KB
Loading

src/components/Seo.tsx

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import * as React from 'react';
66
import Head from 'next/head';
77
import {withRouter, Router} from 'next/router';
8+
import {siteConfig} from '../siteConfig';
89

910
export interface SeoProps {
1011
title: string;
@@ -16,6 +17,18 @@ export interface SeoProps {
1617
searchOrder?: number;
1718
}
1819

20+
const deployedTranslations = [
21+
'en',
22+
'zh-hans',
23+
'es',
24+
// We'll add more languages when they have enough content.
25+
];
26+
27+
function getDomain(languageCode: string): string {
28+
const subdomain = languageCode === 'en' ? '' : languageCode + '.';
29+
return subdomain + 'react.dev';
30+
}
31+
1932
export const Seo = withRouter(
2033
({
2134
title,
@@ -26,29 +39,37 @@ export const Seo = withRouter(
2639
isHomePage,
2740
searchOrder,
2841
}: SeoProps & {router: Router}) => {
42+
const siteDomain = getDomain(siteConfig.languageCode);
43+
const canonicalUrl = `https://${siteDomain}${
44+
router.asPath.split(/[\?\#]/)[0]
45+
}`;
2946
const pageTitle = isHomePage ? 'React' : title + ' – React';
3047
// Twitter's meta parser is not very good.
3148
const twitterTitle = pageTitle.replace(/[<>]/g, '');
3249
return (
3350
<Head>
34-
{/* DEFAULT */}
35-
3651
<meta name="viewport" content="width=device-width, initial-scale=1" />
37-
3852
{title != null && <title key="title">{pageTitle}</title>}
3953
{description != null && (
4054
<meta name="description" key="description" content={description} />
4155
)}
42-
{/* <link rel="icon" type="image/x-icon" href={favicon} />
43-
<link rel="apple-touch-icon" href={favicon} /> @todo favicon */}
56+
<link rel="canonical" href={canonicalUrl} />
57+
<link
58+
rel="alternate"
59+
href={canonicalUrl.replace(siteDomain, getDomain('en'))}
60+
hrefLang="x-default"
61+
/>
62+
{deployedTranslations.map((languageCode) => (
63+
<link
64+
key={'alt-' + languageCode}
65+
rel="alternate"
66+
hrefLang={languageCode}
67+
href={canonicalUrl.replace(siteDomain, getDomain(languageCode))}
68+
/>
69+
))}
4470
<meta property="fb:app_id" content="623268441017527" />
45-
{/* OPEN GRAPH */}
4671
<meta property="og:type" key="og:type" content="website" />
47-
<meta
48-
property="og:url"
49-
key="og:url"
50-
content={`https://react.dev${router.asPath.split(/[\?\#]/)[0]}`}
51-
/>
72+
<meta property="og:url" key="og:url" content={canonicalUrl} />
5273
{title != null && (
5374
<meta property="og:title" content={pageTitle} key="og:title" />
5475
)}
@@ -59,14 +80,11 @@ export const Seo = withRouter(
5980
content={description}
6081
/>
6182
)}
62-
6383
<meta
6484
property="og:image"
6585
key="og:image"
66-
content={`https://react.dev${image}`}
86+
content={`https://${siteDomain}${image}`}
6787
/>
68-
69-
{/* TWITTER */}
7088
<meta
7189
name="twitter:card"
7290
key="twitter:card"
@@ -88,11 +106,10 @@ export const Seo = withRouter(
88106
content={description}
89107
/>
90108
)}
91-
92109
<meta
93110
name="twitter:image"
94111
key="twitter:image"
95-
content={`https://react.dev${image}`}
112+
content={`https://${siteDomain}${image}`}
96113
/>
97114
<meta
98115
name="google-site-verification"

src/content/community/conferences.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,18 @@ July 07 & 08, 2023. Bangalore, India (In-person event)
6060

6161
[Website](https://reactnexus.com/) - [Twitter](https://twitter.com/ReactNexus) - [Linkedin](https://www.linkedin.com/company/react-nexus) - [YouTube](https://www.youtube.com/reactify_in)
6262

63+
### React Rally 2023 🐙 {/*react-rally-2023*/}
64+
August 17 & 18, 2023. Salt Lake City, UT, USA
65+
66+
[Website](https://www.reactrally.com/) - [Twitter](https://twitter.com/ReactRally) - [Instagram](https://www.instagram.com/reactrally/)
67+
6368
### React On The Beach 2023 {/*react-on-the-beach-2023*/}
6469
September 07, 2023. Amsterdam, Netherlands (In-person event)
6570

6671
[Website](https://reactonthebeach.com/) - [Twitter](https://twitter.com/reactonthebeach)
6772

6873
### React India 2023 {/*react-india-2023*/}
69-
Oct 5 - 7, 2023. In-person in Goa, India (hybrid event) + Oct 3 2023 - remote day
74+
Oct 5 - 7, 2023. In-person in Goa, India (hybrid event) + Oct 3 2023 - remote day
7075

7176
[Website](https://www.reactindia.io) - [Twitter](https://twitter.com/react_india) - [Facebook](https://www.facebook.com/ReactJSIndia) - [Youtube](https://www.youtube.com/channel/UCaFbHCBkPvVv1bWs_jwYt3w)
7277

@@ -137,7 +142,7 @@ September 1-2, 2022 - Remote event
137142
[Website](https://www.react-native.eu/?utm_campaign=React_Native_EU&utm_source=referral&utm_content=reactjs_community_conferences) -
138143
[Twitter](https://twitter.com/react_native_eu) -
139144
[Linkedin](https://www.linkedin.com/showcase/react-native-eu) -
140-
[Facebook](https://www.facebook.com/reactnativeeu/) -
145+
[Facebook](https://www.facebook.com/reactnativeeu/) -
141146
[Instagram](https://www.instagram.com/reactnative_eu/)
142147

143148
### ReactNext 2022 {/*reactnext-2022*/}
@@ -258,7 +263,7 @@ August 30 - September 3, 2021 - remote event
258263
### React Case Study Festival 2021 {/*react-case-study-festival-2021*/}
259264
April 27-28, 2021 - remote event
260265

261-
[Website](https://link.geekle.us/react/offsite) - [LinkedIn](https://www.linkedin.com/events/reactcasestudyfestival6721300943411015680/) - [Facebook](https://www.facebook.com/events/255715435820203)
266+
[Website](https://link.geekle.us/react/offsite) - [LinkedIn](https://www.linkedin.com/events/reactcasestudyfestival6721300943411015680/) - [Facebook](https://www.facebook.com/events/255715435820203)
262267

263268
### React Summit - Remote Edition 2021 {/*react-summit---remote-edition-2021*/}
264269
April 14-16, 2021, 7am PST / 10am EST / 4pm CEST - remote event
@@ -510,7 +515,7 @@ August 18 in Guangzhou, China
510515

511516
[Website](https://react.w3ctech.com)
512517

513-
### React Rally {/*react-rally*/}
518+
### React Rally 2018{/*react-rally-2018*/}
514519
August 16-17 in Salt Lake City, Utah USA
515520

516521
[Website](http://www.reactrally.com) - [Twitter](https://twitter.com/reactrally)

src/pages/_document.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
*/
44

55
import {Html, Head, Main, NextScript} from 'next/document';
6+
import {siteConfig} from '../siteConfig';
67

78
const MyDocument = () => {
89
return (
9-
<Html lang="zh-Hans">
10+
<Html lang={siteConfig.languageCode}>
1011
<Head />
1112
<body className="font-text font-medium antialiased text-lg bg-wash dark:bg-wash-dark text-secondary dark:text-secondary-dark leading-base">
1213
<script

src/siteConfig.ts renamed to src/siteConfig.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@
22
* Copyright (c) Facebook, Inc. and its affiliates.
33
*/
44

5-
export const siteConfig = {
6-
editUrl: 'https://github.com/reactjs/react.dev/tree/main/src/pages',
5+
exports.siteConfig = {
6+
// --------------------------------------
7+
// Translations should replace these lines:
8+
languageCode: 'zh-hans',
9+
hasLegacySite: true,
10+
// --------------------------------------
711
copyright: `Copyright © ${new Date().getFullYear()} Facebook Inc. All Rights Reserved.`,
812
repoUrl: 'https://github.com/facebook/react',
913
twitterUrl: 'https://twitter.com/reactjs',

0 commit comments

Comments
 (0)