diff --git a/layout/_partial/main/navbar/list_post.ejs b/layout/_partial/main/navbar/list_post.ejs
index 17c0360..311605a 100644
--- a/layout/_partial/main/navbar/list_post.ejs
+++ b/layout/_partial/main/navbar/list_post.ejs
@@ -5,24 +5,30 @@
<% } else { %>
<%- __('btn.recent_publish') %>
<% } %>
- <% if (page.category) { %>
- <%- __('btn.category') + __('symbol.colon') + page.category %>
- <% } else if (page.layout == 'categories') { %>
- <%- __('btn.categories') %>
- <% } else { %>
- <%- __('btn.categories') %>
+ <% if (site.categories && site.categories.length > 0) { %>
+ <% if (page.category) { %>
+ <%- __('btn.category') + __('symbol.colon') + page.category %>
+ <% } else if (page.layout == 'categories') { %>
+ <%- __('btn.categories') %>
+ <% } else { %>
+ <%- __('btn.categories') %>
+ <% } %>
<% } %>
- <% if (page.tag) { %>
- <%- __('btn.tag') + __('symbol.colon') + page.tag %>
- <% } else if (page.layout == 'tags') { %>
- <%- __('btn.tags') %>
- <% } else { %>
- <%- __('btn.tags') %>
+ <% if (site.tags && site.tags.length > 0) { %>
+ <% if (page.tag) { %>
+ <%- __('btn.tag') + __('symbol.colon') + page.tag %>
+ <% } else if (page.layout == 'tags') { %>
+ <%- __('btn.tags') %>
+ <% } else { %>
+ <%- __('btn.tags') %>
+ <% } %>
<% } %>
- <% if (is_archive()) { %>
- <%- __('btn.archives') %>
- <% } else { %>
- <%- __('btn.archives') %>
+ <% if (site.posts && site.posts.length > 0) { %>
+ <% if (is_archive()) { %>
+ <%- __('btn.archives') %>
+ <% } else { %>
+ <%- __('btn.archives') %>
+ <% } %>
<% } %>
-
+
diff --git a/scripts/generators/categories.js b/scripts/generators/categories.js
index 410a3fa..2d4a018 100644
--- a/scripts/generators/categories.js
+++ b/scripts/generators/categories.js
@@ -3,9 +3,13 @@
*/
hexo.extend.generator.register('categories', function (locals) {
- return {
- path: hexo.config.category_dir + '/index.html',
- data: locals.posts,
- layout: ['categories']
+ if (locals.categories && locals.categories.length > 0) {
+ return {
+ path: hexo.config.category_dir + '/index.html',
+ data: locals.posts,
+ layout: ['categories']
+ }
+ } else {
+ return {};
}
-});
\ No newline at end of file
+});
diff --git a/scripts/generators/tags.js b/scripts/generators/tags.js
index 09eb19c..40a07b8 100644
--- a/scripts/generators/tags.js
+++ b/scripts/generators/tags.js
@@ -2,10 +2,14 @@
* tags v1 | https://github.com/xaoxuu/hexo-theme-stellar/
*/
- hexo.extend.generator.register('tags', function (locals) {
- return {
- path: hexo.config.tag_dir + '/index.html',
- data: locals.posts,
- layout: ['tags']
+hexo.extend.generator.register('tags', function (locals) {
+ if (locals.tags && locals.tags.length > 0) {
+ return {
+ path: hexo.config.tag_dir + '/index.html',
+ data: locals.posts,
+ layout: ['tags']
+ }
+ } else {
+ return {};
}
-});
\ No newline at end of file
+});
diff --git a/scripts/generators/wiki.js b/scripts/generators/wiki.js
index 27aef64..a93036b 100644
--- a/scripts/generators/wiki.js
+++ b/scripts/generators/wiki.js
@@ -3,9 +3,19 @@
*/
hexo.extend.generator.register('wiki', function (locals) {
- return {
- path: (hexo.config.wiki_dir || 'wiki') + '/index.html',
- data: locals.posts,
- layout: ['wiki']
+ var hasWiki = false;
+ locals.pages.forEach((page, i) => {
+ if (page.layout == 'wiki') {
+ hasWiki = true;
+ }
+ });
+ if (hasWiki) {
+ return {
+ path: (hexo.config.wiki_dir || 'wiki') + '/index.html',
+ data: locals.posts,
+ layout: ['wiki']
+ }
+ } else {
+ return {};
}
-});
\ No newline at end of file
+});