diff --git a/website/core/Header.js b/website/core/Header.js index c84c98c401b03f..c83d7334b1b71d 100644 --- a/website/core/Header.js +++ b/website/core/Header.js @@ -13,14 +13,19 @@ var React = require('React'); var slugify = require('slugify'); var Header = React.createClass({ + contextTypes: { + permalink: React.PropTypes.string + }, + render: function() { var slug = slugify(this.props.toSlug || this.props.children); var H = 'h' + this.props.level; + var base = this.context.permalink || ''; return ( {this.props.children} - {' '}# + {' '}# ); } diff --git a/website/layout/AutodocsLayout.js b/website/layout/AutodocsLayout.js index 036ca09731370a..269314cb1e0443 100644 --- a/website/layout/AutodocsLayout.js +++ b/website/layout/AutodocsLayout.js @@ -448,6 +448,14 @@ var Modal = React.createClass({ }); var Autodocs = React.createClass({ + childContextTypes: { + permalink: React.PropTypes.string + }, + + getChildContext: function() { + return {permalink: this.props.metadata.permalink}; + }, + renderFullDescription: function(docs) { if (!docs.fullDescription) { return; diff --git a/website/layout/DocsLayout.js b/website/layout/DocsLayout.js index d92b5d06ebc8db..d84d9682d7a190 100644 --- a/website/layout/DocsLayout.js +++ b/website/layout/DocsLayout.js @@ -16,6 +16,14 @@ var React = require('React'); var Site = require('Site'); var DocsLayout = React.createClass({ + childContextTypes: { + permalink: React.PropTypes.string + }, + + getChildContext: function() { + return {permalink: this.props.metadata.permalink}; + }, + render: function() { var metadata = this.props.metadata; var content = this.props.children; diff --git a/website/layout/PageLayout.js b/website/layout/PageLayout.js index a4ff02c6045849..94697a207d6e79 100644 --- a/website/layout/PageLayout.js +++ b/website/layout/PageLayout.js @@ -14,6 +14,14 @@ var Site = require('Site'); var Marked = require('Marked'); var support = React.createClass({ + childContextTypes: { + permalink: React.PropTypes.string + }, + + getChildContext: function() { + return {permalink: this.props.metadata.permalink}; + }, + render: function() { var metadata = this.props.metadata; var content = this.props.children; diff --git a/website/src/react-native/support.js b/website/src/react-native/support.js index abf51306be9849..de1b4bbe7f4118 100644 --- a/website/src/react-native/support.js +++ b/website/src/react-native/support.js @@ -13,6 +13,13 @@ var center = require('center'); var H2 = require('H2'); var support = React.createClass({ + childContextTypes: { + permalink: React.PropTypes.string + }, + + getChildContext: function() { + return {permalink: 'support.html'}; + }, render: function() { return (