Skip to content

Commit a876afd

Browse files
authored
Merge pull request #75 from ethereum/edit-link
Add "Edit page" button to desktop ToC
2 parents 5a91fd1 + bfd884f commit a876afd

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/layouts/Static.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import UpcomingEventsList from "@/components/UpcomingEventsList"
1414

1515
import { isLangRightToLeft } from "@/lib/utils/translations"
1616
import { getLocaleTimestamp } from "@/lib/utils/time"
17+
import { CONTENT_DIR } from "@/lib/constants"
1718

1819
import type { ChildOnlyProp, Lang } from "@/lib/types"
1920
import type { MdPageContent, StaticFrontmatter } from "@/lib/interfaces"
@@ -71,6 +72,12 @@ export const StaticLayout: React.FC<IProps> = ({
7172
const { locale } = useRouter()
7273
const isRightToLeft = isLangRightToLeft(frontmatter.lang as Lang)
7374

75+
const repo =
76+
process.env.NEXT_PUBLIC_GITHUB_REPO ||
77+
"ethereum/ethereum-org-website"
78+
const baseEditPath = `https://github.com/${repo}/tree/dev/${CONTENT_DIR}/`
79+
const absoluteEditPath = baseEditPath + slug + "index.md"
80+
7481
return (
7582
<Box w="full" ml={2}>
7683
<Flex
@@ -114,7 +121,6 @@ export const StaticLayout: React.FC<IProps> = ({
114121
<TableOfContents
115122
position="relative"
116123
zIndex={2}
117-
// editPath={absoluteEditPath}
118124
items={tocItems}
119125
isMobile
120126
maxDepth={frontmatter.sidebarDepth || 2}
@@ -125,7 +131,7 @@ export const StaticLayout: React.FC<IProps> = ({
125131
<FeedbackCard isArticle />
126132
</Box>
127133
<TableOfContents
128-
// editPath={absoluteEditPath}
134+
editPath={absoluteEditPath}
129135
items={tocItems}
130136
maxDepth={frontmatter.sidebarDepth || 2}
131137
hideEditButton={!!frontmatter.hideEditButton}

0 commit comments

Comments
 (0)