Skip to content

Commit

Permalink
docs(v2): document editUrl
Browse files Browse the repository at this point in the history
  • Loading branch information
yangshun committed Apr 5, 2020
1 parent 4d0126e commit a046ccc
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,27 @@ function BlogPostPage(props) {
isBlogPostPage>
<BlogPostContents />
</BlogPostItem>
<EditPage url={editUrl} />
<div>
{editUrl && (
<a href={editUrl} target="_blank" rel="noreferrer noopener">
<svg
fill="currentColor"
height="1.2em"
width="1.2em"
preserveAspectRatio="xMidYMid meet"
viewBox="0 0 40 40"
style={{
marginRight: '0.3em',
verticalAlign: 'sub',
}}>
<g>
<path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z" />
</g>
</svg>
Edit this page
</a>
)}
</div>
{(nextItem || prevItem) && (
<div className="margin-vert--xl">
<BlogPostPaginator nextItem={nextItem} prevItem={prevItem} />
Expand Down
24 changes: 22 additions & 2 deletions packages/docusaurus-theme-classic/src/theme/DocItem/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
import useBaseUrl from '@docusaurus/useBaseUrl';
import DocPaginator from '@theme/DocPaginator';
import useTOCHighlight from '@theme/hooks/useTOCHighlight';
import EditPage from '@theme/EditPage';

import classnames from 'classnames';
import styles from './styles.module.css';
Expand Down Expand Up @@ -128,7 +127,28 @@ function DocItem(props) {
<div className="margin-vert--xl">
<div className="row">
<div className="col">
<EditPage url={editUrl} />
{editUrl && (
<a
href={editUrl}
target="_blank"
rel="noreferrer noopener">
<svg
fill="currentColor"
height="1.2em"
width="1.2em"
preserveAspectRatio="xMidYMid meet"
viewBox="0 0 40 40"
style={{
marginRight: '0.3em',
verticalAlign: 'sub',
}}>
<g>
<path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z" />
</g>
</svg>
Edit this page
</a>
)}
</div>
{(lastUpdatedAt || lastUpdatedBy) && (
<div className="col text--right">
Expand Down
36 changes: 0 additions & 36 deletions packages/docusaurus-theme-classic/src/theme/EditPage/index.js

This file was deleted.

5 changes: 5 additions & 0 deletions website/docs/using-plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ module.exports = {
* relative to site dir
*/
path: 'blog',
/**
* URL for editing a blog post, example: 'https://github.com/facebook/docusaurus/edit/master/website/blog/'
*/
editUrl:
'https://github.com/facebook/docusaurus/edit/master/website/blog',
/**
* URL route for the blog section of your site
* do not include trailing slash
Expand Down

0 comments on commit a046ccc

Please sign in to comment.