Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Edit this page' option added #159

Merged
merged 1 commit into from
May 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 17 additions & 4 deletions site/components/MDX.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ const components = {
p: Paragraph
}

export default function MdxPage({ children }) {
export default function MdxPage({ children, editUrl }) {
const { Component, frontmatter } = children

let podcastEmbed

if (frontmatter.podcast && frontmatter.podcast.includes("life-itself")) {
Expand All @@ -24,7 +24,7 @@ export default function MdxPage({ children }) {
return (
<article className="prose dark:prose-invert mx-auto p-6">
<header>
<div className="mb-6">
<div className="my-6">
{frontmatter.title && <h1 className="mb-0">{frontmatter.title}</h1>}
{frontmatter.authors && (
<div className="-mt-6">
Expand Down Expand Up @@ -74,7 +74,20 @@ export default function MdxPage({ children }) {
</div>
</header>
<main>
<Component components={components} />
<div className="my-6">
<Component components={components} />
</div>
{editUrl && (
<div className='mt-12 mb-6'>
<a className="flex no-underline font-semibold text-yellow-li" href={editUrl} target="_blank">
Edit this page
<span className="mx-1">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round" d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" />
</svg>
</span>
</a>
</div>)}
</main>
</article>
);
Expand Down
2 changes: 2 additions & 0 deletions site/config/siteConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down