Added turbo:goal support

This commit is contained in:
vvm
2020-08-31 23:08:53 +03:00
parent 2d3f75902f
commit c5a7ff6e1c
4 changed files with 60 additions and 1 deletions

View File

@@ -71,6 +71,19 @@ function items(items, channel) {
let fullContent = '<header>' + img + ' <h1>' + item.title + '</h1>' + menu + '</header>' + item.content;
if (item.goals.length > 0) {
item.goals.forEach(goal => item_values.push({
"turbo:goal": {
_attr: {
type: goal.type || 'yandex',
'turbo-goal-id': goal.id,
name: goal.name,
id: goal.counter_id,
}
}
}))
}
item_values.push({'turbo:content': {_cdata: fullContent}});
if (typeof item.related !== 'undefined') {
@@ -128,7 +141,8 @@ function itemData(data) {
related: data.related,
relatedfinity: data.relatedfinity || false,
turboSource: data.turboSource || '',
turboTopic: data.turboTopic || ''
turboTopic: data.turboTopic || '',
goals: data.goals || [],
};
}
/**