diff --git a/src/components/EditPage.tsx b/src/components/EditPage.tsx
new file mode 100644
index 00000000000..27c0a8ae0b9
--- /dev/null
+++ b/src/components/EditPage.tsx
@@ -0,0 +1,24 @@
+import {ExternalLink} from './ExternalLink';
+import {IconGitHub} from './Icon/IconGitHub';
+
+const RepoEditLink = `https://github.com/reactjs/react.dev/edit/main/`;
+
+type EditPageProps = {
+ path: string;
+ isIndexPage: boolean;
+};
+
+export const EditPage = ({path, isIndexPage}: EditPageProps) => {
+ return (
+
+
+ Edit this page
+
+ );
+};
diff --git a/src/components/Layout/Page.tsx b/src/components/Layout/Page.tsx
index 24d379589de..8dd23cefa30 100644
--- a/src/components/Layout/Page.tsx
+++ b/src/components/Layout/Page.tsx
@@ -21,9 +21,18 @@ import {HomeContent} from './HomeContent';
import {TopNav} from './TopNav';
import cn from 'classnames';
import Head from 'next/head';
+import {EditPage} from 'components/EditPage';
import(/* webpackPrefetch: true */ '../MDX/CodeBlock/CodeBlock');
+type Section =
+ | 'learn'
+ | 'reference'
+ | 'community'
+ | 'blog'
+ | 'home'
+ | 'unknown';
+
interface PageProps {
children: React.ReactNode;
toc: Array;
@@ -34,7 +43,7 @@ interface PageProps {
canary?: boolean;
description?: string;
};
- section: 'learn' | 'reference' | 'community' | 'blog' | 'home' | 'unknown';
+ section: Section;
languages?: Languages | null;
}
@@ -58,6 +67,13 @@ export function Page({
const isHomePage = cleanedPath === '/';
const isBlogIndex = cleanedPath === '/blog';
+ const editableSections: Section[] = [
+ 'community',
+ 'blog',
+ 'learn',
+ 'reference',
+ ];
+
let content;
if (isHomePage) {
content = ;
@@ -88,6 +104,21 @@ export function Page({
+ {editableSections.includes(section) && !!route?.path && (
+
+ )}
{!isBlogIndex && (