From d850615af0aff215a68844bb63cb61ee3ecfdc15 Mon Sep 17 00:00:00 2001 From: TieHaxJan <3xgamer@gmx.de> Date: Tue, 18 Feb 2025 15:56:04 +0100 Subject: [PATCH] add my page --- content/.gitkeep | 0 quartz.config.ts | 7 ++-- quartz.layout.ts | 55 +++++++++++++++++++++++++----- quartz/components/Explorer.tsx | 9 +++++ quartz/components/ExplorerNode.tsx | 13 +++++-- 5 files changed, 68 insertions(+), 16 deletions(-) delete mode 100644 content/.gitkeep diff --git a/content/.gitkeep b/content/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/quartz.config.ts b/quartz.config.ts index dc339d987..243b7307d 100644 --- a/quartz.config.ts +++ b/quartz.config.ts @@ -8,7 +8,7 @@ import * as Plugin from "./quartz/plugins" */ const config: QuartzConfig = { configuration: { - pageTitle: "🪴 Quartz 4.0", + pageTitle: "Janigma", pageTitleSuffix: "", enableSPA: true, enablePopovers: true, @@ -16,7 +16,7 @@ const config: QuartzConfig = { provider: "plausible", }, locale: "en-US", - baseUrl: "quartz.jzhao.xyz", + baseUrl: "summaries.janigma.com", ignorePatterns: ["private", "templates", ".obsidian"], defaultDateType: "created", generateSocialImages: false, @@ -57,9 +57,6 @@ const config: QuartzConfig = { plugins: { transformers: [ Plugin.FrontMatter(), - Plugin.CreatedModifiedDate({ - priority: ["frontmatter", "filesystem"], - }), Plugin.SyntaxHighlighting({ theme: { light: "github-light", diff --git a/quartz.layout.ts b/quartz.layout.ts index f45da0c92..4d6692581 100644 --- a/quartz.layout.ts +++ b/quartz.layout.ts @@ -6,14 +6,17 @@ export const sharedPageComponents: SharedLayout = { head: Component.Head(), header: [], afterBody: [], - footer: Component.Footer({ - links: { - GitHub: "https://github.com/jackyzha0/quartz", - "Discord Community": "https://discord.gg/cRFFHYye7t", - }, - }), + footer: Component.Footer(), } +const order = new Map([ + ["FS3", 1], + ["FS4", 2], + ["FS5", 3], + ["Elective", 4], + ["Blog", 5] +]); + // components for pages that display a single page (e.g. a single note) export const defaultContentPageLayout: PageLayout = { beforeBody: [ @@ -27,10 +30,33 @@ export const defaultContentPageLayout: PageLayout = { Component.MobileOnly(Component.Spacer()), Component.Search(), Component.Darkmode(), - Component.Explorer(), + Component.Explorer( + { + title: "Inhalt", + useSavedState: false, + sortFn: (a, b) => { + const orderA = order.get(a.displayName) ?? 99; + const orderB = order.get(b.displayName) ?? 99; + + return orderA - orderB; + } + } + ), ], right: [ - Component.Graph(), + Component.Graph({ + localGraph: { + scale: 2.0, + depth: 3, + fontSize: 1.5, + repelForce: 0.2, + }, + globalGraph: { + scale: 3.0, + fontSize: 1, + repelForce: 2, + } + }), Component.DesktopOnly(Component.TableOfContents()), Component.Backlinks(), ], @@ -44,7 +70,18 @@ export const defaultListPageLayout: PageLayout = { Component.MobileOnly(Component.Spacer()), Component.Search(), Component.Darkmode(), - Component.Explorer(), + Component.Explorer( + { + title: "Inhalt", + useSavedState: false, + sortFn: (a, b) => { + const orderA = order.get(a.displayName) ?? 99; + const orderB = order.get(b.displayName) ?? 99; + + return orderA - orderB; + } + } + ), ], right: [], } diff --git a/quartz/components/Explorer.tsx b/quartz/components/Explorer.tsx index ac276a8bc..1df7b1056 100644 --- a/quartz/components/Explorer.tsx +++ b/quartz/components/Explorer.tsx @@ -7,6 +7,7 @@ import { ExplorerNode, FileNode, Options } from "./ExplorerNode" import { QuartzPluginData } from "../plugins/vfile" import { classNames } from "../util/lang" import { i18n } from "../i18n" +import { FullSlug } from "../util/path" // Options interface defined in `ExplorerNode` to avoid circular dependency const defaultOptions = { @@ -49,6 +50,14 @@ export default ((userOpts?: Partial) => { function constructFileTree(allFiles: QuartzPluginData[]) { // Construct tree from allFiles fileTree = new FileNode("") + fileTree.add({ + slug: "Photography" as FullSlug, + externalLink: "https://jan.schulz-nigmann.de" + }) + fileTree.add({ + slug: "GitHub" as FullSlug, + externalLink: "https://github.com/TieHaxJan" + }) allFiles.forEach((file) => fileTree.add(file)) // Execute all functions (sort, filter, map) that were provided (if none were provided, only default "sort" is applied) diff --git a/quartz/components/ExplorerNode.tsx b/quartz/components/ExplorerNode.tsx index e57d67715..0b7f8f103 100644 --- a/quartz/components/ExplorerNode.tsx +++ b/quartz/components/ExplorerNode.tsx @@ -160,9 +160,10 @@ type ExplorerNodeProps = { opts: Options fileData: QuartzPluginData fullPath?: string + externalLink?: { url: string; target?: string } } -export function ExplorerNode({ node, opts, fullPath, fileData }: ExplorerNodeProps) { +export function ExplorerNode({ node, opts, fullPath, fileData, externalLink }: ExplorerNodeProps) { // Get options const folderBehavior = opts.folderClickBehavior const isDefaultOpen = opts.folderDefaultState === "open" @@ -170,10 +171,18 @@ export function ExplorerNode({ node, opts, fullPath, fileData }: ExplorerNodePro // Calculate current folderPath const folderPath = node.name !== "" ? joinSegments(fullPath ?? "", node.name) : "" const href = resolveRelative(fileData.slug!, folderPath as SimpleSlug) + "/" + const isExternal = node.file && node.file.externalLink !== undefined return ( <> - {node.file ? ( + {isExternal ? ( + // External link node +
  • + + {node.displayName} + +
  • + ) : node.file ? ( // Single file node