Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ <h3><strong>{{service.title|default:service.name}}</strong></h3>
resources.push({
id: '{{ resource_meta.id }}',
name: '{{ resource_meta.unique_identifier }}',
title: '{{ resource_meta.title }}',
abstract: '{{ resource_meta.abstract|safe|truncatechars:20|striptags }}',
title: '{{ resource_meta.title|escapejs }}',
abstract: '{{ resource_meta.abstract|truncatechars:20|striptags|escapejs }}',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The order of the truncatechars and striptags filters should be swapped. It is more robust to strip HTML tags before truncating the string. This ensures that truncation applies to the actual content text rather than the HTML markup, preventing broken HTML and providing a more accurate truncation of the visible text.

                abstract: '{{ resource_meta.abstract|striptags|truncatechars:20|escapejs }}',

type: '{{ resource_meta.remote_resource_type }}'
});
{% endfor %}
Expand Down
Loading