diff --git a/lib/core/Doc.js b/lib/core/Doc.js index a12e076c3c..a263431f04 100644 --- a/lib/core/Doc.js +++ b/lib/core/Doc.js @@ -20,29 +20,39 @@ const translateThisDoc = translate( // inner doc component for article itself class Doc extends React.Component { render() { - let editLink = !this.props.version && - this.props.config.editUrl && ( + let docSource = this.props.source; + + if (this.props.version && this.props.version !== 'next') { + // If versioning is enabled and the current version is not next, we need to trim out "version-*" from the source if we want a valid edit link. + docSource = docSource.match(new RegExp(/version-.*\/(.*\.md)/, 'i'))[1]; + } + + let editLink = this.props.config.editUrl && ( + + {editThisDoc} + + ); + + // If internationalization is enabled, show Recruiting link instead of Edit Link. + if ( + this.props.language != 'en' && + this.props.config.translationRecruitingLink + ) { + editLink = ( - {editThisDoc} + {translateThisDoc} ); - if (this.props.language != 'en') { - editLink = !this.props.version && - this.props.config.translationRecruitingLink && ( - - {translateThisDoc} - - ); } return (