diff --git a/site/components/MDX.js b/site/components/MDX.js index 587e852..fe906ff 100644 --- a/site/components/MDX.js +++ b/site/components/MDX.js @@ -9,7 +9,7 @@ const components = { p: Paragraph } -export default function MdxPage({ children }) { +export default function MdxPage({ children, editUrl }) { const { Component, frontmatter: { title, description, date, authors, youtube, podcast, image, _raw }} = children @@ -120,7 +120,20 @@ export default function MdxPage({ children }) {
+
+
+ {editUrl && ( +
+ + Edit this page + + + + + + +
)}
diff --git a/site/config/siteConfig.js b/site/config/siteConfig.js index ef93a96..b93ba16 100644 --- a/site/config/siteConfig.js +++ b/site/config/siteConfig.js @@ -3,6 +3,8 @@ import Logo from "../public/img/life-itself-logo.svg" const siteConfig = { title: "Making Sense of Crypto and Web3", url: "https://web3.lifeitself.us", + repoRoot: "https://github.com/life-itself/web3", + repoEditPath: "/edit/main/", tagline: "", description: "Introductions to key concepts and ideas in crypto and web3. Plus in-depth evaluation of its potential impact.", diff --git a/site/package-lock.json b/site/package-lock.json index ba0604e..36b4cf4 100644 --- a/site/package-lock.json +++ b/site/package-lock.json @@ -1890,15 +1890,6 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/load-script/-/load-script-1.0.0.tgz", "integrity": "sha1-BJGTngvuVkPuSUp+PaPSuscMbKQ=" -<<<<<<< Updated upstream - }, - "loader-runner": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.2.0.tgz", - "integrity": "sha512-92+huvxMvYlMzMt0iIOukcwYBFpkYJdpl2xsZ7LrlayO7E8SOv+JJUEK17B/dJIHAOLMfh2dZZ/Y18WgmGtYNw==", - "peer": true -======= ->>>>>>> Stashed changes }, "lodash.camelcase": { "version": "4.3.0", @@ -2315,15 +2306,6 @@ "version": "5.2.1", "resolved": "https://registry.npmjs.org/memoize-one/-/memoize-one-5.2.1.tgz", "integrity": "sha512-zYiwtZUcYyXKo/np96AGZAckk+FWWsUdJ3cHGGmld7+AhvcWmQyGCYUh1hc4Q/pkOhb65dQR/pqCyK0cOaHz4Q==" -<<<<<<< Updated upstream - }, - "merge-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", - "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", - "peer": true -======= ->>>>>>> Stashed changes }, "merge2": { "version": "1.4.1", @@ -3075,16 +3057,6 @@ "react-is": "^16.13.1" } }, - "prop-types": { - "version": "15.8.1", - "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", - "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", - "requires": { - "loose-envify": "^1.4.0", - "object-assign": "^4.1.1", - "react-is": "^16.13.1" - } - }, "property-information": { "version": "6.1.1", "resolved": "https://registry.npmjs.org/property-information/-/property-information-6.1.1.tgz", diff --git a/site/pages/[...slug].js b/site/pages/[...slug].js index 8a15d62..4ec7602 100644 --- a/site/pages/[...slug].js +++ b/site/pages/[...slug].js @@ -1,6 +1,7 @@ import MdxPage from '../components/MDX'; import { allOtherPages } from 'contentlayer/generated'; import { useMDXComponent } from 'next-contentlayer/hooks'; +import siteConfig from "../config/siteConfig" export default function Page({ body, ...rest }) { @@ -13,9 +14,14 @@ export default function Page({ body, ...rest }) { created: rest.created === "Invalid Date" ? null : rest.created }, }; + + // enable editing content only for claims, concepts, and guide for now + const editUrl = ['claims', 'concepts', 'guide'].includes(rest._raw.sourceFileDir) + ? siteConfig.repoRoot + siteConfig.repoEditPath + rest._raw.sourceFilePath + : null return ( - + ); }