Skip to content

Commit 1705660

Browse files
fix: change plugin order to fix Giscus comments but sacrifice index page pagination look (Rapide) and cooler credit on mobile (#151)
1 parent 9d45a1d commit 1705660

File tree

3 files changed

+90
-85
lines changed

3 files changed

+90
-85
lines changed

astro.config.mjs

Lines changed: 24 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,21 @@ import { rehypeHeadingIds } from "@astrojs/markdown-remark";
22
import starlight from "@astrojs/starlight";
33
import lunaria from "@lunariajs/starlight";
44
import { defineConfig } from "astro/config";
5+
import { config as loadDotenv } from "dotenv";
56
import starlightBlog from "starlight-blog";
67
import starlightCoolerCredit from "starlight-cooler-credit";
78
import starlightGiscus from "starlight-giscus";
89
import starlightImageZoom from "starlight-image-zoom";
910
import starlightLinksValidator from "starlight-links-validator";
1011
import starlightThemeRapide from "starlight-theme-rapide";
11-
import { loadEnv } from "vite";
1212

1313
import rehypeAutolinkHeadings from "./src/plugins/rehype/autolink-headings";
1414
import rehypeGitHubBadgeLinks from "./src/plugins/rehype/github-badge-links";
1515

16-
const { GISCUS_REPO_ID } = loadEnv(
17-
process.env.GISCUS_REPO_ID,
18-
process.cwd(),
19-
""
20-
);
21-
const { GISCUS_CATEGORY_ID } = loadEnv(
22-
process.env.GISCUS_CATEGORY_ID,
23-
process.cwd(),
24-
""
25-
);
16+
loadDotenv();
17+
18+
const GISCUS_REPO_ID = process.env.GISCUS_REPO_ID;
19+
const GISCUS_CATEGORY_ID = process.env.GISCUS_CATEGORY_ID;
2620

2721
if (!GISCUS_REPO_ID || !GISCUS_CATEGORY_ID) {
2822
console.warn(
@@ -112,14 +106,17 @@ export default defineConfig({
112106
errorOnInvalidHashes: false,
113107
}),
114108
starlightImageZoom(),
115-
starlightThemeRapide(),
116-
starlightCoolerCredit({
117-
credit: {
118-
title: "Credits",
119-
description: "View all credits of this blog →",
120-
href: "https://blog.trueberryless.org/credits",
121-
},
122-
}),
109+
...(GISCUS_REPO_ID && GISCUS_CATEGORY_ID
110+
? [
111+
starlightGiscus({
112+
repo: "trueberryless-org/blog",
113+
repoId: GISCUS_REPO_ID,
114+
category: "Comments",
115+
categoryId: GISCUS_CATEGORY_ID,
116+
lazy: true,
117+
}),
118+
]
119+
: []),
123120
starlightBlog({
124121
title: "Deep Thoughts",
125122
postCount: 7,
@@ -164,17 +161,14 @@ export default defineConfig({
164161
},
165162
},
166163
}),
167-
...(GISCUS_REPO_ID && GISCUS_CATEGORY_ID
168-
? [
169-
starlightGiscus({
170-
repo: "trueberryless-org/blog",
171-
repoId: GISCUS_REPO_ID,
172-
category: "Comments",
173-
categoryId: GISCUS_CATEGORY_ID,
174-
lazy: true,
175-
}),
176-
]
177-
: []),
164+
starlightCoolerCredit({
165+
credit: {
166+
title: "Credits",
167+
description: "View all credits of this blog →",
168+
href: "https://blog.trueberryless.org/credits",
169+
},
170+
}),
171+
starlightThemeRapide(),
178172
],
179173
components: {
180174
MarkdownContent: "./src/components/MarkdownContent.astro",

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,18 @@
2222
"start": "astro dev"
2323
},
2424
"dependencies": {
25-
"@astrojs/check": "^0.9.4",
26-
"@astrojs/markdown-remark": "^6.3.7",
27-
"@astrojs/starlight": "^0.36.0",
25+
"@astrojs/check": "^0.9.5",
26+
"@astrojs/markdown-remark": "6.3.8",
27+
"@astrojs/starlight": "^0.36.1",
2828
"@expressive-code/plugin-collapsible-sections": "^0.41.3",
2929
"@expressive-code/plugin-line-numbers": "^0.41.3",
3030
"@fontsource-variable/atkinson-hyperlegible-next": "^5.2.6",
3131
"@fontsource-variable/jetbrains-mono": "^5.2.8",
3232
"@lucide/astro": "^0.545.0",
3333
"@lunariajs/core": "^0.1.1",
3434
"@lunariajs/starlight": "^0.1.1",
35-
"astro": "^5.14.1",
35+
"astro": "^5.15.1",
36+
"dotenv": "^17.2.3",
3637
"hastscript": "^9.0.1",
3738
"rehype-autolink-headings": "^7.1.0",
3839
"sharp": "^0.34.4",

0 commit comments

Comments
 (0)