fix categories

This commit is contained in:
afc163 2015-06-05 10:28:11 +08:00
parent 31daadf847
commit 84740e38b6
2 changed files with 5 additions and 4 deletions

View File

@ -1,5 +1,5 @@
<script src="/dist/index.js"></script>
{%- set categories = resource.pages|get_all_category %}
{%- set categories = resource.pages|get_components_categories %}
<aside class="aside-container">
<ul>
{%- for category in categories %}

View File

@ -36,12 +36,13 @@ module.exports = function(nico) {
});
return ret;
},
get_all_category: function(pages) {
get_components_categories: function(pages) {
return _.uniq(Object.keys(pages).map(function(key) {
var item = nico.sdk.post.read(key);
if (item.meta.template !== 'component') {
return;
}
return item.meta.category;
}).filter(function(item) {
return item;
}));
},
find_demo_in_component: function(pages, directory) {