Skip to content

Commit

Permalink
merging all conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
react-translations-bot committed Oct 30, 2023
2 parents 5f84f02 + 4bdb87b commit 3075fd6
Show file tree
Hide file tree
Showing 17 changed files with 661 additions and 4 deletions.
8 changes: 7 additions & 1 deletion src/components/Layout/Page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ interface PageProps {
children: React.ReactNode;
toc: Array<TocItem>;
routeTree: RouteItem;
meta: {title?: string; canary?: boolean; description?: string};
meta: {
title?: string;
titleForTitleTag?: string;
canary?: boolean;
description?: string;
};
section: 'learn' | 'reference' | 'community' | 'blog' | 'home' | 'unknown';
}

Expand Down Expand Up @@ -107,6 +112,7 @@ export function Page({children, toc, routeTree, meta, section}: PageProps) {
<>
<Seo
title={title}
titleForTitleTag={meta.titleForTitleTag}
isHomePage={isHomePage}
image={`/images/og-` + section + '.png'}
searchOrder={searchOrder}
Expand Down
17 changes: 16 additions & 1 deletion src/components/Seo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {siteConfig} from '../siteConfig';

export interface SeoProps {
title: string;
titleForTitleTag: undefined | string;
description?: string;
image?: string;
// jsonld?: JsonLDType | Array<JsonLDType>;
Expand Down Expand Up @@ -36,7 +37,11 @@ function getDomain(languageCode: string): string {
export const Seo = withRouter(
({
title,
<<<<<<< HEAD
description = '用于构建 Web 和原生交互界面的库',
=======
titleForTitleTag,
>>>>>>> 4bdb87b172a7723d56d03a5630c8a9870f6f03ec
image = '/images/og-default.png',
router,
children,
Expand All @@ -47,14 +52,24 @@ export const Seo = withRouter(
const canonicalUrl = `https://${siteDomain}${
router.asPath.split(/[\?\#]/)[0]
}`;
<<<<<<< HEAD
const pageTitle = isHomePage ? title : title + ' – React 中文文档';
=======
// Allow setting a different title for Google results
const pageTitle =
(titleForTitleTag ?? title) + (isHomePage ? '' : ' – React');
>>>>>>> 4bdb87b172a7723d56d03a5630c8a9870f6f03ec
// Twitter's meta parser is not very good.
const twitterTitle = pageTitle.replace(/[<>]/g, '');
let description = isHomePage
? 'React is the library for web and native user interfaces. Build user interfaces out of individual pieces called components written in JavaScript. React is designed to let you seamlessly combine components written by independent people, teams, and organizations.'
: 'The library for web and native user interfaces';
return (
<Head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
{title != null && <title key="title">{pageTitle}</title>}
{description != null && (
{isHomePage && (
// Let Google figure out a good description for each page.
<meta name="description" key="description" content={description} />
)}
<link rel="canonical" href={canonicalUrl} />
Expand Down
2 changes: 1 addition & 1 deletion src/content/learn/reacting-to-input-with-state.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ function submitForm(answer) {
// Pretend it's hitting the network.
return new Promise((resolve, reject) => {
setTimeout(() => {
if (answer.toLowerCase() == 'istanbul') {
if (answer.toLowerCase() === 'istanbul') {
resolve();
} else {
reject(new Error('Good guess but a wrong answer. Try again!'));
Expand Down
Loading

0 comments on commit 3075fd6

Please sign in to comment.