Allow controlling number of blog posts in Recent Blogs sidebar. ()

New feature. Allow controlling number of blog posts in Recent Blogs sidebar. Can have qty or ALL.
This commit is contained in:
Eric Nakagawa 2018-02-02 08:11:51 -08:00 committed by Joel Marcey
parent c99cdefd3a
commit dfb70e1829
3 changed files with 35 additions and 4 deletions

View file

@ -13,16 +13,28 @@ const MetadataBlog = require('./MetadataBlog.js');
class BlogSidebar extends React.Component {
render() {
let blogSidebarCount = 5;
let blogSidebarTitle = 'Recent Posts';
if (this.props.config.blogSidebarCount) {
if (this.props.config.blogSidebarCount == 'ALL') {
blogSidebarCount = MetadataBlog.length;
blogSidebarTitle = 'All Blog Posts';
} else {
blogSidebarCount = this.props.config.blogSidebarCount;
}
}
const contents = [
{
name: 'Recent Posts',
links: MetadataBlog.slice(0, 5),
name: blogSidebarTitle,
links: MetadataBlog.slice(0, blogSidebarCount),
},
];
const title = this.props.current && this.props.current.title;
const current = {
id: title || '',
category: 'Recent Posts',
category: blogSidebarTitle,
};
return (
<Container className="docsNavContainer" id="docsNav" wrapper={false}>