# How to make “This page intentionally left blank.” in KOMA script

This question is sequel to question

How do I make pages which were "intentionally left blank"?

The accepted solution there

\documentclass[openright]{scrbook}
\newcommand*{\blankpage}{%
\vspace*{\fill}
\centering This page would be intentionally left blank if we would not wish to inform about that.
\vspace{\fill}}
\makeatletter
\renewcommand*{\cleardoublepage}{\clearpage\if@twoside \ifodd\c@page\else
\blankpage
\thispagestyle{empty}
\newpage
\if@twocolumn\hbox{}\newpage\fi\fi\fi}
\makeatother
\begin{document}
Text
\chapter{First chapter}
\end{document}


does insert blank page warning, but only \mainmatter. \frontmatter, \appendix and \backmatter do not have blank page warning.

Is there any way to tweak this solution so it would produce blank page warning for the whole document?

With scrbook the command to redefine is \cleardoubleoddstandardpage

\documentclass[openright]{scrbook}

\newcommand*{\blankpage}{%
\par\vspace*{\fill}%
if we would not wish to inform about that.\par}
\vspace{\fill}%
}
\makeatletter
\renewcommand*{\cleardoubleoddstandardpage}{%
\clearpage
\if@twoside
\ifodd\c@page
\else
\blankpage
\thispagestyle{empty}%
\newpage
\if@twocolumn\hbox{}\newpage\fi
\fi
\fi
}
\makeatother

\begin{document}

\frontmatter
\tableofcontents

\mainmatter

\chapter{First chapter}

\chapter{Second chapter}

\end{document}


You can define a special pagestyle for those pages using the package scrlayer and the KOMA option cleardoublepage=<pagestyle>

\documentclass[open=right]{scrbook}

\newcommand*{\blankpage}{%
\par\vspace*{\fill}%
if we would not wish to inform about that.\par}
\vspace{\fill}%
}

\usepackage{scrlayer}
\DeclareNewLayer[
foreground,
textarea,
contents=\blankpage
]{blankpage.fg}
\DeclarePageStyleByLayers{blank}{blankpage.fg}
\KOMAoptions{cleardoublepage=blank}

\begin{document}
\frontmatter
\tableofcontents
\mainmatter
\chapter{First chapter}
\chapter{Second chapter}
\end{document}


This will also work if a blank page is inserted by a \cleardoubleevenpage command or if you switch to open=left.