Skip to content

Commit

Permalink
fix navigation related issue (jestjs#3482)
Browse files Browse the repository at this point in the history
  • Loading branch information
stryju authored and cpojer committed May 5, 2017
1 parent 92ffecb commit d80bbbf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions website/layout/DocsLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ const DocsLayout = React.createClass({
language={metadata.language}
/>
<div className="docs-prevnext">
{metadata.previous && <a className="docs-prev button" href={metadata.previous + '.html#content'}>&larr; Previous</a>}
{metadata.next && <a className="docs-next button" href={metadata.next + '.html#content'}>Continue Reading &rarr;</a>}
{metadata.previous && <a className="docs-prev button" href={stripLang(metadata.previous) + '.html#content'}>&larr; Previous</a>}
{metadata.next && <a className="docs-next button" href={stripLang(metadata.next) + '.html#content'}>Continue Reading &rarr;</a>}
</div>
</Container>
</div>
Expand All @@ -44,4 +44,8 @@ const DocsLayout = React.createClass({
},
});

function stripLang(s) {
return s.replace(/^[a-z]{2}-/, '');
}

module.exports = DocsLayout;
4 changes: 2 additions & 2 deletions website/server/convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,10 @@ function execute() {
metadata.localized_id = metadata.id;
metadata.id = language + '-' + metadata.id;
if (metadata.previous) {
metadata.previous = metadata.previous;
metadata.previous = language + '-' + metadata.previous;
}
if (metadata.next) {
metadata.next = metadata.next;
metadata.next = language + '-' + metadata.next;
}
metadata.language = language;
metadatas.files.push(metadata);
Expand Down

0 comments on commit d80bbbf

Please sign in to comment.