diff --git a/HISTORY.rst b/HISTORY.rst
index 849f2c0811..2fd3e277d6 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -1,3 +1,7 @@
+2.5.3 (2017-07-XX)
+==================
+- Fix HTML mark up in window title. GitLab issue #397.
+
2.5.2 (2017-07-08)
==================
- Improve new document creation signal handling.
diff --git a/mayan/apps/appearance/templates/appearance/calculate_form_title.html b/mayan/apps/appearance/templates/appearance/calculate_form_title.html
index 8af5e01bb6..907b90511e 100644
--- a/mayan/apps/appearance/templates/appearance/calculate_form_title.html
+++ b/mayan/apps/appearance/templates/appearance/calculate_form_title.html
@@ -5,7 +5,10 @@
{% smart_setting 'APPEARANCE_MAXIMUM_TITLE_LENGTH' as maximum_title_length %}
{# Avoid horizontal scroll on small displays #}
-
+{% if not html_title %}
+
+{% endif %}
+
{% if title %}
{{ title|truncatechars:maximum_title_length }}
{% else %}
@@ -19,4 +22,7 @@
{% endif %}
{% endif %}
{% endif %}
-
+
+{% if not html_title %}
+
+{% endif %}
diff --git a/mayan/apps/appearance/templates/appearance/generic_form.html b/mayan/apps/appearance/templates/appearance/generic_form.html
index 5603365792..6f486381fd 100644
--- a/mayan/apps/appearance/templates/appearance/generic_form.html
+++ b/mayan/apps/appearance/templates/appearance/generic_form.html
@@ -2,7 +2,7 @@
{% load common_tags %}
-{% block title %}{% include 'appearance/calculate_form_title.html' %}{% endblock %}
+{% block title %}{% include 'appearance/calculate_form_title.html' with html_title=True %}{% endblock %}
{% block content %}
{% include 'appearance/calculate_form_title.html' %}
diff --git a/mayan/apps/appearance/templates/appearance/generic_list.html b/mayan/apps/appearance/templates/appearance/generic_list.html
index 521e455e26..285f62c18c 100644
--- a/mayan/apps/appearance/templates/appearance/generic_list.html
+++ b/mayan/apps/appearance/templates/appearance/generic_list.html
@@ -4,7 +4,7 @@
{% load navigation_tags %}
-{% block title %}{% include 'appearance/calculate_form_title.html' %}{% endblock %}
+{% block title %}{% include 'appearance/calculate_form_title.html' with html_title=True %}{% endblock %}
{% block content %}
{% if title %}
diff --git a/mayan/apps/appearance/templates/appearance/generic_multi_subtemplates.html b/mayan/apps/appearance/templates/appearance/generic_multi_subtemplates.html
index 0af36c26bb..bbc3a53c1e 100644
--- a/mayan/apps/appearance/templates/appearance/generic_multi_subtemplates.html
+++ b/mayan/apps/appearance/templates/appearance/generic_multi_subtemplates.html
@@ -2,7 +2,7 @@
{% load common_tags %}
-{% block title %}{% include 'appearance/calculate_form_title.html' %}{% endblock %}
+{% block title %}{% include 'appearance/calculate_form_title.html' with html_title=True %}{% endblock %}
{% block content %}
{% if main_title %}
diff --git a/mayan/apps/appearance/templates/appearance/generic_multiform_subtemplate.html b/mayan/apps/appearance/templates/appearance/generic_multiform_subtemplate.html
index 851c43dcb4..c1c145db14 100644
--- a/mayan/apps/appearance/templates/appearance/generic_multiform_subtemplate.html
+++ b/mayan/apps/appearance/templates/appearance/generic_multiform_subtemplate.html
@@ -1,6 +1,5 @@
{% load i18n %}
{% load static %}
-
{% include 'appearance/calculate_form_title.html' %}
diff --git a/mayan/apps/appearance/templates/appearance/generic_wizard.html b/mayan/apps/appearance/templates/appearance/generic_wizard.html
index b3fe60da99..dce48af1c8 100644
--- a/mayan/apps/appearance/templates/appearance/generic_wizard.html
+++ b/mayan/apps/appearance/templates/appearance/generic_wizard.html
@@ -2,7 +2,7 @@
{% load i18n %}
-{% block title %}{% include 'appearance/calculate_form_title.html' %}{% endblock %}
+{% block title %}{% include 'appearance/calculate_form_title.html' with html_title=True %}{% endblock %}
{% block content %}
{% include 'appearance/calculate_form_title.html' %}
diff --git a/mayan/apps/document_indexing/templates/document_indexing/node_details.html b/mayan/apps/document_indexing/templates/document_indexing/node_details.html
index 9fa2ffee6c..b20d8fc17f 100644
--- a/mayan/apps/document_indexing/templates/document_indexing/node_details.html
+++ b/mayan/apps/document_indexing/templates/document_indexing/node_details.html
@@ -4,7 +4,7 @@
{% load navigation_tags %}
-{% block title %}{% include 'appearance/calculate_form_title.html' %}{% endblock %}
+{% block title %}{% include 'appearance/calculate_form_title.html' with html_title=True %}{% endblock %}
{% block content %}
{% if title %}