mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-20 04:27:04 +02:00
add sourceCodeButton to site config (#93)
This commit is contained in:
parent
a3d1fb693b
commit
9c7d8e55a9
2 changed files with 16 additions and 6 deletions
|
@ -79,6 +79,9 @@ headerLinks: [
|
||||||
|
|
||||||
`gaTrackingId` - Google Analytics tracking ID to track page views.
|
`gaTrackingId` - Google Analytics tracking ID to track page views.
|
||||||
|
|
||||||
|
|
||||||
|
`sourceCodeButton` - the type of button to use for pointing to your source code. If this field is non-null, the site will pull in the appropriate button code in the header, for you to be able to render as you see fit. Currently accepted values: `"github"`, `"none"`. Defaults to `"github"`.
|
||||||
|
|
||||||
Users can also add their own custom fields if they wish to provide some data across different files.
|
Users can also add their own custom fields if they wish to provide some data across different files.
|
||||||
|
|
||||||
## Example siteConfig.js with all fields
|
## Example siteConfig.js with all fields
|
||||||
|
@ -130,8 +133,9 @@ const siteConfig = {
|
||||||
apiKey:
|
apiKey:
|
||||||
"0f9f28b9ab9efae89810921a351753b5",
|
"0f9f28b9ab9efae89810921a351753b5",
|
||||||
indexName: "github"
|
indexName: "github"
|
||||||
}
|
},
|
||||||
gaTrackingId: "U-A2352"
|
gaTrackingId: "U-A2352",
|
||||||
|
sourceCodeButton: "github"
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = siteConfig;
|
module.exports = siteConfig;
|
||||||
|
|
|
@ -17,6 +17,10 @@ class Head extends React.Component {
|
||||||
links.map(link => {
|
links.map(link => {
|
||||||
if (link.blog) hasBlog = true;
|
if (link.blog) hasBlog = true;
|
||||||
});
|
});
|
||||||
|
let sourceCodeButton = this.props.config.sourceCodeButton;
|
||||||
|
// defaults to github, but other values may be allowed in the future
|
||||||
|
let includeGithubButton =
|
||||||
|
sourceCodeButton === 'github' || sourceCodeButton == null;
|
||||||
return (
|
return (
|
||||||
<head>
|
<head>
|
||||||
<meta charSet="utf-8" />
|
<meta charSet="utf-8" />
|
||||||
|
@ -64,7 +68,9 @@ class Head extends React.Component {
|
||||||
title={this.props.config.title + " Blog RSS Feed"}
|
title={this.props.config.title + " Blog RSS Feed"}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
{includeGithubButton &&
|
||||||
<script async defer src="https://buttons.github.io/buttons.js" />
|
<script async defer src="https://buttons.github.io/buttons.js" />
|
||||||
|
}
|
||||||
</head>
|
</head>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue