Commit a1615e36 authored by Isabella Skořepová's avatar Isabella Skořepová

Implement autotagging with Článek

metadata to disable: `notarticle = true`

Also simplified theme.js and writeFiles.js which also fixed weird bug
Fixes #22
parent e040dc85
Pipeline #46 skipped
......@@ -12,7 +12,18 @@ module.exports = function(obj) {
var tags = [];
var tagPages = {};
obj.pages.forEach(function(article) {
if(!article.metadata.tags && !article.metadata.notarticle) {
article.metadata.tags = [ 'Článek' ];
}
if(article.metadata.tags) {
if(!article.metadata.notarticle) {
var hasarticletag = false;
article.metadata.tags.forEach(function(tag) {
if(toURL(tag) == 'clanek') hasarticletag = true;
})
if(!hasarticletag) article.metadata.tags.push('Článek');
}
var ntags = [];
article.metadata.tags.forEach(function(tag) {
tag = {
......
......@@ -11,12 +11,9 @@ module.exports = function(obj) {
todo++;
jobs.run('nunjucks', obj, type)
.then(function(data) {
if(!obj.rendered) obj.rendered = [];
data.forEach(function(o){
if(o.type == 'html') obj.content = o.content;
else {
if(!obj.otherContent) obj.otherContent = [];
obj.otherContent.push(o);
}
obj.rendered.push(o);
});
done();
......
......@@ -20,10 +20,8 @@ module.exports = function(obj) {
}
var writeFile = function(article) {
var filename = path.join(builddir,article.file,'index.html');
doWrite(filename, article.content);
if(article.otherContent) {
article.otherContent.forEach(function(o) {
if(article.rendered) {
article.rendered.forEach(function(o) {
var f = path.join(builddir,article.file,'index.'+o.type);
doWrite(f, o.content);
})
......
......@@ -22,7 +22,7 @@
{{page.metadata.perex_e | truncate}}
{% else %}
{% if page.content %}
{{ page.content | string | striptags | truncate }}
{{ page.content | striptags | truncate }}
{% endif %}
{% endif %}
{% endif %}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment