Add option to avoid indexing site (#142)

This commit is contained in:
Ricky Vetter 2017-10-18 11:35:30 -07:00 committed by Joel Marcey
parent a26bba14c6
commit 768ed88978
3 changed files with 5 additions and 1 deletions

View file

@ -27,6 +27,8 @@ The `siteConfig` object contains the bulk of the configuration settings for your
`projectName` - Project name. This must match your GitHub repo project name (case sensitive). `projectName` - Project name. This must match your GitHub repo project name (case sensitive).
`noIndex` - Boolean. If true, Docusaurus will politely ask crawlers and search engines to avoid indexing your site. This is done with a header tag and so only applies to docs and pages. Will not attempt to hide static resources. This is a best effort request. Malicious crawlers can and will still index your site.
`headerLinks` - Links that will be used in the header navigation bar. The `label` field of each object will be the link text and will also be translated for each language. `headerLinks` - Links that will be used in the header navigation bar. The `label` field of each object will be the link text and will also be translated for each language.
Example Usage: Example Usage:
@ -104,6 +106,7 @@ const siteConfig = {
baseUrl: "/test-site/", baseUrl: "/test-site/",
// baseUrl: "/", // baseUrl: "/",
projectName: "docusaurus", projectName: "docusaurus",
noIndex: false,
headerLinks: [ headerLinks: [
{ doc: "doc1", label: "Docs" }, { doc: "doc1", label: "Docs" },
{ page: "help", label: "Help" }, { page: "help", label: "Help" },

View file

@ -29,7 +29,7 @@ class Head extends React.Component {
<meta property="og:type" content="website" /> <meta property="og:type" content="website" />
<meta property="og:url" content={this.props.url} /> <meta property="og:url" content={this.props.url} />
<meta property="og:description" content={this.props.description} /> <meta property="og:description" content={this.props.description} />
<meta name="robots" content="noindex" /> {this.props.config.noIndex && <meta name="robots" content="noindex" />}
{this.props.config.ogImage && ( {this.props.config.ogImage && (
<meta <meta
property="og:image" property="og:image"

View file

@ -34,6 +34,7 @@ const siteConfig = {
baseUrl: "/", baseUrl: "/",
projectName: "Docusaurus", projectName: "Docusaurus",
cname: "docusaurus.io", cname: "docusaurus.io",
noIndex: true,
users, users,
editUrl: editUrl:
"https://github.com/facebookexperimental/docusaurus/edit/master/docs/", "https://github.com/facebookexperimental/docusaurus/edit/master/docs/",