diff --git a/core/modules/node/templates/node.html.twig b/core/modules/node/templates/node.html.twig
index ede27e6..feead8a 100644
--- a/core/modules/node/templates/node.html.twig
+++ b/core/modules/node/templates/node.html.twig
@@ -81,11 +81,11 @@
{%
set add_classes = [
'node',
- 'node--type-' ~ node.bundle,
+ 'node--type-' ~ node.bundle|clean_class,
node.promoted ? 'node--promoted',
node.sticky ? 'node--sticky',
not node.published ? 'node--unpublished',
- 'node--view-mode-' ~ view_mode,
+ 'node--view-mode-' ~ view_mode|clean_class,
preview ? ' node--preview'
]
%}
diff --git a/core/themes/bartik/templates/node.html.twig b/core/themes/bartik/templates/node.html.twig
index 43f4d88..29a9e9f 100644
--- a/core/themes/bartik/templates/node.html.twig
+++ b/core/themes/bartik/templates/node.html.twig
@@ -74,11 +74,11 @@
{%
set add_classes = [
'node',
- 'node--type-' ~ node.bundle,
+ 'node--type-' ~ node.bundle|clean_class,
node.promoted ? 'node--promoted',
node.sticky ? 'node--sticky',
not node.published ? 'node--unpublished',
- 'node--view-mode-' ~ view_mode,
+ 'node--view-mode-' ~ view_mode|clean_class,
preview ? ' node--preview',
'clearfix'
]