Add versioning functionality

This commit is contained in:
Frank Li 2017-08-03 10:25:01 -07:00
parent 58452ea963
commit 3598dffc58
12 changed files with 568 additions and 132 deletions

View file

@ -92,14 +92,22 @@ class HeaderNav extends React.Component {
}
makeInternalLinks(link) {
const linkWithLang = link.href.replace(
let updatedLink = link.href.replace(
/\/LANGUAGE\//,
"/" + this.props.language + "/"
);
if (this.props.version) {
updatedLink = updatedLink.replace(
/\/VERSION\//,
"/" + this.props.version + "/"
);
} else {
updatedLink = updatedLink.replace(/\/VERSION\//, "/");
}
return (
<li key={link.section}>
<a
href={linkWithLang}
href={updatedLink}
className={link.section === this.props.section ? "active" : ""}
>
{translation[this.props.language]
@ -111,14 +119,10 @@ class HeaderNav extends React.Component {
}
makeExternalLinks(link) {
const linkWithLang = link.href.replace(
/\/LANGUAGE\//,
"/" + this.props.language + "/"
);
return (
<li key={link.section}>
<a
href={linkWithLang}
href={link.href}
className={link.section === this.props.section ? "active" : ""}
target={siteConfig.externalLinkTarget || "_self"}
>