diff --git a/modules/default/newsfeed/newsfeed.js b/modules/default/newsfeed/newsfeed.js
index 2fe340a2..0b781964 100644
--- a/modules/default/newsfeed/newsfeed.js
+++ b/modules/default/newsfeed/newsfeed.js
@@ -37,7 +37,8 @@ Module.register("newsfeed", {
endTags: [],
prohibitedWords: [],
scrollLength: 500,
- logFeedWarnings: false
+ logFeedWarnings: false,
+ dangerouslyDisableAutoEscaping: false
},
// Define required scripts.
diff --git a/modules/default/newsfeed/newsfeed.njk b/modules/default/newsfeed/newsfeed.njk
index 531f0b47..04f0ec79 100644
--- a/modules/default/newsfeed/newsfeed.njk
+++ b/modules/default/newsfeed/newsfeed.njk
@@ -1,3 +1,11 @@
+{% macro escapeText(text, dangerouslyDisableAutoEscaping=false) %}
+ {% if dangerouslyDisableAutoEscaping %}
+ {{ text | safe}}
+ {% else %}
+ {{ text }}
+ {% endif %}
+{% endmacro %}
+
{% if loaded %}
{% if config.showAsList %}
@@ -14,14 +22,14 @@
{% endif %}
- {{ item.title }}
+ {{ escapeText(item.title, config.dangerouslyDisableAutoEscaping) }}
{% if config.showDescription %}
{% if config.truncDescription %}
- {{ item.description | truncate(config.lengthDescription) }}
+ {{ escapeText(item.description | truncate(config.lengthDescription), config.dangerouslyDisableAutoEscaping) }}
{% else %}
- {{ item.description }}
+ {{ escapeText(item.description, config.dangerouslyDisableAutoEscaping) }}
{% endif %}
{% endif %}
@@ -33,7 +41,7 @@
{% if (config.showSourceTitle and sourceTitle) or config.showPublishDate %}
{% if sourceTitle and config.showSourceTitle %}
- {{ sourceTitle | safe }}{% if config.showPublishDate %}, {% else %}: {% endif %}
+ {{ escapeText(sourceTitle, config.dangerouslyDisableAutoEscaping) }}{% if config.showPublishDate %}, {% else %}: {% endif %}
{% endif %}
{% if config.showPublishDate %}
{{ publishDate }}:
@@ -41,14 +49,14 @@
{% endif %}
- {{ title }}
+ {{ escapeText(title, config.dangerouslyDisableAutoEscaping) }}
{% if config.showDescription %}
{% if config.truncDescription %}
- {{ description | truncate(config.lengthDescription) | safe }}
+ {{ escapeText(description | truncate(config.lengthDescription), config.dangerouslyDisableAutoEscaping) }}
{% else %}
- {{ description | safe }}
+ {{ escapeText(description, config.dangerouslyDisableAutoEscaping) }}
{% endif %}
{% endif %}