diff --git a/layout/_pre.ejs b/layout/_pre.ejs new file mode 100755 index 0000000..907e56f --- /dev/null +++ b/layout/_pre.ejs @@ -0,0 +1,11 @@ +<% +if (is_home() || is_category() || is_archive() || is_tag() || page.layout == 'list') { + if (theme.layout.on_list.sidebar.length == 0) { + page.sidebar = false; + } +} else { + if (theme.layout.on_page.sidebar.length == 0) { + page.sidebar = false; + } +} +%> diff --git a/layout/archive.ejs b/layout/archive.ejs index df2b50d..c0a888b 100755 --- a/layout/archive.ejs +++ b/layout/archive.ejs @@ -1,3 +1,4 @@ +<%- partial('_pre') %>
'> <% if (page.year || page.month) { %> <%- partial('_partial/archive') %> diff --git a/layout/category.ejs b/layout/category.ejs index 5dca8cc..4ec837d 100755 --- a/layout/category.ejs +++ b/layout/category.ejs @@ -1,3 +1,4 @@ +<%- partial('_pre') %> <% page.comments = false; %>
'> <% if (site.posts && site.posts.length > 0) { %> diff --git a/layout/index.ejs b/layout/index.ejs index 11ef3c8..b3d854a 100755 --- a/layout/index.ejs +++ b/layout/index.ejs @@ -1,4 +1,6 @@ -
'> +<%- partial('_pre') %> +<% console.log('index: page.sidebar', page.sidebar); %> +
'> <%- partial('_partial/archive') %>
<%- partial('_partial/side') %> diff --git a/layout/links.ejs b/layout/links.ejs index a5cbf85..df0e1c2 100755 --- a/layout/links.ejs +++ b/layout/links.ejs @@ -1,3 +1,4 @@ +<%- partial('_pre') %>
'>
<%- partial('_partial/meta',{post:page, position:'header'}) %> diff --git a/layout/list.ejs b/layout/list.ejs index 0afe0f2..42c1f54 100755 --- a/layout/list.ejs +++ b/layout/list.ejs @@ -1,3 +1,4 @@ +<%- partial('_pre') %> <% page.comments = false; %>
'> <% if (site.posts && site.posts.length > 0) { %> diff --git a/layout/page.ejs b/layout/page.ejs index 3db1a63..3290103 100755 --- a/layout/page.ejs +++ b/layout/page.ejs @@ -1,3 +1,4 @@ +<%- partial('_pre') %>
'> <%- partial('_partial/article', {post: page, index: false}) %>
diff --git a/layout/post.ejs b/layout/post.ejs index 3db1a63..3290103 100755 --- a/layout/post.ejs +++ b/layout/post.ejs @@ -1,3 +1,4 @@ +<%- partial('_pre') %>
'> <%- partial('_partial/article', {post: page, index: false}) %>
diff --git a/layout/tag.ejs b/layout/tag.ejs index 95fa0b6..f36a72e 100755 --- a/layout/tag.ejs +++ b/layout/tag.ejs @@ -1,3 +1,4 @@ +<%- partial('_pre') %> <% page.comments = false; %>
'> <% if (site.posts && site.posts.length > 0) { %>