Skip to content

Commit 2cf1b45

Browse files
giscus.ejs needs to check for darkMode
and not use variables that won't be declared
1 parent cdf0d3e commit 2cf1b45

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

news/changelog-1.7.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## In this release
44

5+
- ([#12700](https://github.com/quarto-dev/quarto-cli/issues/12700)): Giscus not loading on a site without dark mode configured.
6+
57
## In previous releases
68

79
- ([#6607](https://github.com/quarto-dev/quarto-cli/issues/6607)): Add missing beamer template update for beamer theme options: `colorthemeoptions`, `fontthemeoptions`, `innerthemeoptions` and `outerthemeoptions`.

src/format/html/format-html.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ export async function htmlFormatExtras(
609609
giscusAfterBody,
610610
renderEjs(
611611
formatResourcePath("html", join("giscus", "giscus.ejs")),
612-
{ giscus },
612+
{ giscus, darkMode: options.darkMode },
613613
),
614614
);
615615
includeAfterBody.push(giscusAfterBody);

src/resources/formats/html/giscus/giscus.ejs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
const getTheme = () => {
77
let baseTheme = document.getElementById('giscus-base-theme').value;
88
let altTheme = document.getElementById('giscus-alt-theme').value;
9+
<% if (darkMode !== undefined) { %>
910
if (authorPrefersDark) {
1011
[baseTheme, altTheme] = [altTheme, baseTheme];
1112
}
13+
<% } %>
1214
return document.body.classList.contains('quarto-dark') ? altTheme : baseTheme;
1315
};
1416
const script = document.createElement("script");

0 commit comments

Comments
 (0)