Add config option for setting title of the blog sidebar (#770)

* Allow controlling the title of the blog sidebar

* Update guides-blog.md
This commit is contained in:
Jonathan Ingram 2018-06-15 17:08:34 +10:00 committed by Yangshun Tay
parent 62a2c7c1a5
commit 58fba70dea
4 changed files with 19 additions and 3 deletions

View file

@ -14,11 +14,12 @@ const MetadataBlog = require('./MetadataBlog.js');
class BlogSidebar extends React.Component {
render() {
let blogSidebarCount = 5;
let blogSidebarTitle = 'Recent Posts';
let blogSidebarTitleConfig = this.props.config.blogSidebarTitle || {};
let blogSidebarTitle = blogSidebarTitleConfig.default || 'Recent Posts';
if (this.props.config.blogSidebarCount) {
if (this.props.config.blogSidebarCount == 'ALL') {
blogSidebarCount = MetadataBlog.length;
blogSidebarTitle = 'All Blog Posts';
blogSidebarTitle = blogSidebarTitleConfig.all || 'All Blog Posts';
} else {
blogSidebarCount = this.props.config.blogSidebarCount;
}