Skip to content

Commit d227b8c

Browse files
committed
config now supports customHeadCSS
1 parent 1680180 commit d227b8c

File tree

5 files changed

+13
-5
lines changed

5 files changed

+13
-5
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,11 @@ export const SITE_CONFIG: NoteHostSiteConfig = {
136136
// Google Font name, you can choose from https://fonts.google.com
137137
googleFont: 'Roboto',
138138

139-
// Custom JS for head and body of a Notion page
139+
// Custom CSS/JS for head and body of a Notion page
140+
customHeadCSS: `
141+
.notion-topbar {
142+
background: lightblue
143+
}`,
140144
customHeadJS: googleTag(GOOGLE_TAG_ID),
141145
customBodyJS: PAGE_SCRIPT_JS_STRING,
142146
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "notehost",
3-
"version": "1.0.29",
3+
"version": "1.0.30",
44
"description": "NoteHost is a free and powerful Notion hosting service.",
55
"repository": "https://github.com/velsa/notehost",
66
"homepage": "https://github.com/velsa/notehost",

src/rewriters/head-rewriter.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export class HeadRewriter {
99
}
1010

1111
element(element: Element) {
12-
const { googleFont, customHeadJS } = this.siteConfig
12+
const { googleFont, customHeadJS, customHeadCSS } = this.siteConfig
1313

1414
if (googleFont) {
1515
element.append(
@@ -37,7 +37,9 @@ export class HeadRewriter {
3737
div.notion-topbar-mobile > div:nth-child(4) { display: none !important; }
3838
div.notion-topbar-mobile > div:nth-child(7) { display: none !important; }
3939
div.notion-topbar-mobile > div:nth-child(1n).toggle-mode { display: block !important; }
40-
</style>${customHeadJS ?? ''}`,
40+
${customHeadCSS ?? ''}
41+
</style>
42+
${customHeadJS ?? ''}`,
4143
{
4244
html: true,
4345
},

src/types.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ export interface NoteHostSiteConfigFull {
3838
// Google Font name, you can choose from https://fonts.google.com
3939
googleFont?: string
4040

41-
// Custom JS to be injected in <head> and <body>
41+
// Custom CSS/JS to be injected in <head> and <body>
42+
customHeadCSS?: string
4243
customHeadJS?: string
4344
customBodyJS?: string
4445

templates/default/src/site-config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export const SITE_CONFIG: NoteHostSiteConfig = {
4949
googleFont: 'Roboto',
5050

5151
// Custom JS for head and body of a Notion page
52+
customHeadCSS: ``,
5253
customHeadJS: googleTag(GOOGLE_TAG_ID),
5354
customBodyJS: PAGE_SCRIPT_JS_STRING,
5455
}

0 commit comments

Comments
 (0)