import Document , { Head , Html , Main , NextScript } from 'next/document' ; class MyDocument extends Document { render ( ) { return ( < Html lang = "en" > < Head > < link rel = "shortcut icon" href = "/icons/favicon.ico" / > < link rel = "apple-touch-icon" href = "/icons/apple-touch-icon.png" / > < link rel = "manifest" href = "/manifest.json" / > < /Head> < body className = "dark" > < script dangerouslySetInnerHTML = { { __html : `!function(){var a=document.body.classList;a.remove("dark");var e=localStorage.getItem("theme");e?a.add(e.replace(/"/g,"")):window.matchMedia("(prefers-color-scheme: dark)").matches?a.add("dark"):a.add("light")}()` } } /> < Main / > < NextScript /> < /body> < /Html>); } } export default MyDocument ;