From 2d6dc176c3e1fbb520a5da1beb60bbb1d8e948ba Mon Sep 17 00:00:00 2001
From: Pelayo Arbués <gonzalezpelayo@gmail.com>
Date: Thu, 31 Aug 2023 19:12:06 +0000
Subject: [PATCH] Adds Pelayo Arbues to showcase (#435)
---
quartz/components/renderPage.tsx | 23 ++++++++++++-----------
1 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/quartz/components/renderPage.tsx b/quartz/components/renderPage.tsx
index ab93709..eb1291f 100644
--- a/quartz/components/renderPage.tsx
+++ b/quartz/components/renderPage.tsx
@@ -2,8 +2,8 @@
import { QuartzComponent, QuartzComponentProps } from "./types"
import HeaderConstructor from "./Header"
import BodyConstructor from "./Body"
-import { JSResourceToScriptElement, StaticResources } from "../resources"
-import { CanonicalSlug, pathToRoot } from "../path"
+import { JSResourceToScriptElement, StaticResources } from "../util/resources"
+import { FullSlug, joinSegments, pathToRoot } from "../util/path"
interface RenderComponents {
head: QuartzComponent
@@ -15,19 +15,20 @@
footer: QuartzComponent
}
-export function pageResources(
- slug: CanonicalSlug,
- staticResources: StaticResources,
-): StaticResources {
+export function pageResources(slug: FullSlug, staticResources: StaticResources): StaticResources {
const baseDir = pathToRoot(slug)
- const contentIndexPath = baseDir + "/static/contentIndex.json"
+ const contentIndexPath = joinSegments(baseDir, "static/contentIndex.json")
const contentIndexScript = `const fetchData = fetch(\`${contentIndexPath}\`).then(data => data.json())`
return {
- css: [baseDir + "/index.css", ...staticResources.css],
+ css: [joinSegments(baseDir, "index.css"), ...staticResources.css],
js: [
- { src: baseDir + "/prescript.js", loadTime: "beforeDOMReady", contentType: "external" },
+ {
+ src: joinSegments(baseDir, "prescript.js"),
+ loadTime: "beforeDOMReady",
+ contentType: "external",
+ },
{
loadTime: "beforeDOMReady",
contentType: "inline",
@@ -36,7 +37,7 @@
},
...staticResources.js,
{
- src: baseDir + "/postscript.js",
+ src: joinSegments(baseDir, "postscript.js"),
loadTime: "afterDOMReady",
moduleType: "module",
contentType: "external",
@@ -46,7 +47,7 @@
}
export function renderPage(
- slug: CanonicalSlug,
+ slug: FullSlug,
componentData: QuartzComponentProps,
components: RenderComponents,
pageResources: StaticResources,
--
Gitblit v1.10.0