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

@ -10,11 +10,13 @@ const BlogPost = require('./BlogPost.js');
const BlogSidebar = require('./BlogSidebar.js');
const Container = require('./Container.js');
const Site = require('./Site.js');
const utils = require('./utils.js');
// used for entire blog posts, i.e., each written blog article with sidebar with site header/footer
class BlogPostLayout extends React.Component {
renderSocialButtons() {
const post = this.props.metadata;
let post = this.props.metadata;
post.path = utils.getPath(post.path, this.props.config.cleanUrl);
const fbComment = this.props.config.facebookAppId &&
this.props.config.facebookComments && (
@ -92,10 +94,12 @@ class BlogPostLayout extends React.Component {
}
render() {
let post = this.props.metadata;
post.path = utils.getPath(post.path, this.props.config.cleanUrl);
return (
<Site
className="sideNavVisible"
url={'blog/' + this.props.metadata.path}
url={'blog/' + post.path}
title={this.props.metadata.title}
language={'en'}
description={this.getDescription()}
@ -104,13 +108,13 @@ class BlogPostLayout extends React.Component {
<div className="docMainWrapper wrapper">
<BlogSidebar
language={'en'}
current={this.props.metadata}
current={post}
config={this.props.config}
/>
<Container className="mainContainer documentContainer postContainer blogContainer">
<div className="lonePost">
<BlogPost
post={this.props.metadata}
post={post}
content={this.props.children}
language={'en'}
config={this.props.config}