Enable clean / extension-less url (#677)

This commit is contained in:
Endilie Yacop Sucipto 2018-06-07 04:37:49 +08:00 committed by Joel Marcey
parent aee255219b
commit 31f0c27f81
14 changed files with 124 additions and 50 deletions

View file

@ -8,7 +8,7 @@
const MarkdownBlock = require('./MarkdownBlock.js');
const React = require('react');
const utils = require('./utils');
const utils = require('./utils.js');
// inner blog component for the article itself, without sidebar/header/footer
class BlogPost extends React.Component {
@ -24,7 +24,12 @@ class BlogPost extends React.Component {
<a
className="button"
href={
this.props.config.baseUrl + 'blog/' + this.props.post.path
this.props.config.baseUrl +
'blog/' +
utils.getPath(
this.props.post.path,
this.props.config.cleanUrl
)
}>
Read More
</a>
@ -73,7 +78,12 @@ class BlogPost extends React.Component {
const post = this.props.post;
return (
<h1>
<a href={this.props.config.baseUrl + 'blog/' + post.path}>
<a
href={
this.props.config.baseUrl +
'blog/' +
utils.getPath(post.path, this.props.config.cleanUrl)
}>
{post.title}
</a>
</h1>