feat(v2): add editUrl option to docs plugin (#1818)

* feat(v2): add editUrl option to docs plugin

* nits

* misc(v2): nit

* misc(v2): nit
This commit is contained in:
Endi 2019-10-11 02:10:18 +08:00 committed by Yangshun Tay
parent aba9edc12c
commit ae678c9dad
10 changed files with 66 additions and 6 deletions

View file

@ -34,7 +34,7 @@ function DocLegacyItem(props) {
const {siteConfig = {}} = useDocusaurusContext();
const {url: siteUrl} = siteConfig;
const {metadata, content: DocContent} = props;
const {description, title, permalink, image: metaImage} = metadata;
const {description, title, permalink, image: metaImage, editUrl} = metadata;
return (
<div>
@ -74,7 +74,23 @@ function DocLegacyItem(props) {
<DocContent />
</div>
</article>
<div className="margin-top--xl margin-bottom--lg">
{editUrl && (
<div className="margin-vert--xl">
<div className="row">
<div className="col">
{editUrl && (
<a
href={editUrl}
target="_blank"
rel="noreferrer noopener">
Edit this page
</a>
)}
</div>
</div>
</div>
)}
<div className="margin-vert--lg">
<DocLegacyPaginator metadata={metadata} />
</div>
</div>