mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-10 15:47:23 +02:00
Use absoluteURL instead of relativeURL for next/prev links (#783)
* Remove trailing slash for docs url * undo remove trailing slash & use absoluteURL for next/prev links * use baseUrl instead of hardcoded slash
This commit is contained in:
parent
3755522681
commit
0f01eace8b
1 changed files with 6 additions and 2 deletions
|
@ -13,16 +13,20 @@ const OnPageNav = require('./nav/OnPageNav.js');
|
|||
const Site = require('./Site.js');
|
||||
const translation = require('../server/translation.js');
|
||||
const path = require('path');
|
||||
const url = require('url');
|
||||
|
||||
// component used to generate whole webpage for docs, including sidebar/header/footer
|
||||
class DocsLayout extends React.Component {
|
||||
getRelativeURL = (from, to) => {
|
||||
const extension = this.props.config.cleanUrl ? '' : '.html';
|
||||
return (
|
||||
const relativeHref =
|
||||
path
|
||||
.relative(from, to)
|
||||
.replace('\\', '/')
|
||||
.replace(/^\.\.\//, '') + extension
|
||||
.replace(/^\.\.\//, '') + extension;
|
||||
return url.resolve(
|
||||
`${this.props.config.baseUrl}${this.props.metadata.permalink}`,
|
||||
relativeHref
|
||||
);
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue