diff --git a/core/modules/node/templates/node.html.twig b/core/modules/node/templates/node.html.twig
index 23d54a2..a7e511d 100644
--- a/core/modules/node/templates/node.html.twig
+++ b/core/modules/node/templates/node.html.twig
@@ -83,7 +83,7 @@
node.isPromoted() ? 'node--promoted',
node.isSticky() ? 'node--sticky',
not node.isPublished() ? 'node--unpublished',
- 'node--view-mode-' ~ view_mode|clean_class,
+ 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 1b2d1b8..c6d0aee 100644
--- a/core/themes/bartik/templates/node.html.twig
+++ b/core/themes/bartik/templates/node.html.twig
@@ -78,7 +78,7 @@
node.isPromoted() ? 'node--promoted',
node.isSticky() ? 'node--sticky',
not node.isPublished() ? 'node--unpublished',
- 'node--view-mode-' ~ view_mode|clean_class,
+ view_mode ? 'node--view-mode-' ~ view_mode|clean_class,
preview ? 'node--preview',
'clearfix',
]