aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2023-12-18 11:41:36 +0100
committerArmand Philippot <git@armandphilippot.com>2023-12-18 11:41:36 +0100
commitd61a572f08321419ac3273d0d0e0191ff2b193e9 (patch)
tree9cf92e2a5afeb915a16a036281c050e935c532b5
parentd7f92841232c257279106c8eef226ce8ea74ecd0 (diff)
fix(pages): add default settings to html tag
When building the website, some styles are missing if JS is disabled in the browser because we rely on Javascript to set the current theme. By providing some default settings, the JS-free version can access those styles.
-rw-r--r--src/pages/_document.tsx8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/pages/_document.tsx b/src/pages/_document.tsx
index 6d065cd..36e0798 100644
--- a/src/pages/_document.tsx
+++ b/src/pages/_document.tsx
@@ -10,8 +10,14 @@ const validPrismThemesStr = VALID_THEMES.map((t) => `"${t}"`);
// eslint-disable-next-line @typescript-eslint/no-shadow -- Required by NextJs
export default function Document() {
+ const defaultAttributes = {
+ [`data-${STORAGE_KEY.MOTION}`]: 'false',
+ [`data-${STORAGE_KEY.THEME}`]: 'light',
+ [PRISM_THEME_ATTRIBUTE]: 'light',
+ };
+
return (
- <Html>
+ <Html {...defaultAttributes}>
<Head>
<Script
dangerouslySetInnerHTML={{