-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathquartz.layout.ts
207 lines (200 loc) · 6.3 KB
/
quartz.layout.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
import 'dotenv/config';
import { PageLayout, SharedLayout } from "./quartz/cfg"
import * as Component from "./quartz/components"
import { SimpleSlug } from "./quartz/util/path";
import { QuartzPluginData } from "./quartz/plugins/vfile"
import { FileTrieNode } from './quartz/util/fileTrie';
import { FileNode } from "./quartz/components/_ExplorerNodeOld";
// Secrets
const myRepoID = process.env.GISCUS_REPO_ID;
const myCategoryID = process.env.GISCUS_CATEGORY_ID;
// Constants for config that are reused a lot
const homepageTitle = "Eilleen's (online!) Everything Notebook"
const modifiedListTitle = "All-files-chronologically-modified"
const mapTitle = "Map"
const tagsToRemove = ["graph-exclude", "explorer-exclude", "backlinks-exclude", "recents-exclude", "search-exclude", "listing-exclude"]
const graphConfig = {
localGraph: {
removeTags: tagsToRemove,
excludeTags: ["graph-exclude"]
},
globalGraph: {
removeTags: tagsToRemove,
excludeTags: ["graph-exclude"]
}
};
const tagListConfig = {
excludeTags: tagsToRemove
}
const explorerConfig = {
filterFn: (node: FileTrieNode) => !(node.data?.tags.includes("explorer-exclude") === true),
mapFn: (node: FileTrieNode) => {
// dont change name of root node
if (!node.isFolder) {
// set emoji for file/folder
node.displayName = "⊹ " + node.displayName
}
},
}
const recentNotesConfig = {
showTags: false,
title: "Recently edited notes:",
showDate: true,
linkToMore: "meta/" + modifiedListTitle as SimpleSlug,
excludeTags: ["recents-exclude"],
filter: (f: QuartzPluginData) => !f.slug!.startsWith("tags/") && !f.slug!.endsWith("/index")
}
const backlinksConfig = {
excludeTags: ["backlinks-exclude"],
hideWhenEmpty: false
}
const breadcrumbsConfig = {
rootName: "🏡"
}
const oldexplorerConfig = {
filterFn: (node: FileNode) => node.name !== "tags" &&
!(node.file?.frontmatter?.tags?.includes("explorer-exclude") === true),
mapFn: (node: FileNode) => {
// dont change name of root node
if (node.depth > 0) {
// set emoji for file/folder
if (node.file) {
node.displayName = "✾ " + node.displayName
} else {
// node.displayName = "📁 " + node.displayName
}
}
}}
const giscusConfig = {
provider: 'giscus',
options: {
// from data-repo
repo: 'fanteastick/quartz-test',
// from data-repo-id
repoId: myRepoID,
// from data-category
category: 'Announcements',
// from data-category-id
categoryId: myCategoryID,
mapping: "specific",
strict: false,
reactionsEnabled: false,
inputPosition: "top",
term: "Guestbook"
}}
const githubSourceConfig = {
repoLink: "https://github.com/fanteastick/quartz-test"
}
///////////////////////////////////////////////////
// components shared across all pages
export const sharedPageComponents: SharedLayout = {
head: Component.Head(),
header: [],
afterBody: [
Component.OnlyFor(
{ titles: [homepageTitle] },
Component.RecentNotes(recentNotesConfig)
),
Component.OnlyFor(
{ titles: [mapTitle]},
Component.RecentNotes({...recentNotesConfig, limit: 8})
),
Component.Comments({
provider: 'giscus',
options: {
// from data-repo
repo: 'fanteastick/quartz-test',
// from data-repo-id
repoId: 'R_kgDOMVIwGw',
// from data-category
category: 'Announcements',
// from data-category-id
categoryId: 'DIC_kwDOMVIwG84Cguqi',
mapping: "specific",
strict: false,
reactionsEnabled: false,
inputPosition: "top",
term: "Guestbook"
}})
],
footer: Component.Footer({
links: {
Main: "https://www.eilleeenz.com/",
GitHub: "https://github.com/fanteastick/quartz-test",
},
}),
}
// components for pages that display a single page (e.g. a single note)
export const defaultContentPageLayout: PageLayout = {
beforeBody: [
Component.Breadcrumbs(breadcrumbsConfig),
Component.ArticleTitle(),
Component.ContentMeta(githubSourceConfig),
Component.TagList(tagListConfig),
Component.MobileOnly(Component.TableOfContents()),
// Component.MobileOnly(Component.OnlyFor({titles: [mapTitle]}, Component.ExplorerOld(explorerConfig)))
],
left: [
Component.PageTitle(),
Component.MobileOnly(Component.Spacer()),
Component.MobileOnly(Component.OverlayExplorer(oldexplorerConfig)),
Component.Row([
Component.Map(),
Component.Darkmode(),
Component.Search(),
]),
// Component.DesktopOnly(Component.OnlyFor({titles: [homepageTitle, mapTitle]}, Component.ExplorerOld(explorerConfig))),
Component.DesktopOnly(Component.TableOfContents()),
Component.DesktopOnly(Component.OnlyFor({titles: [homepageTitle, mapTitle]}, Component.Explorer(explorerConfig))),
Component.FloatingButtons({position: 'right'}),
// Component.DesktopOnly(Component.PageTitle()),
// Component.DesktopOnly(
// Component.Row([
// Component.Map(),
// Component.Darkmode(),
// Component.Search(),
// ])),
// Component.DesktopOnly(Component.TableOfContents()),
// Component.OnlyFor({titles: [homepageTitle, mapTitle]}, Component.Explorer(explorerConfig)),
// Component.FloatingButtons({position: 'right'}),
// Component.MobileOnly(
// Component.Flex({
// components: [
// {Component: Component.PageTitle(),
// justify: "around",
// },
// // {Component: Component.Spacer()},
// {Component: Component.Row([
// Component.Map(),
// Component.Darkmode(),
// Component.Search(),
// ]),
// justify: "around",
// },
// ]}
// )
// ),
],
right: [
Component.Graph(graphConfig),
Component.Backlinks(backlinksConfig),
],
}
// components for pages that display lists of pages (e.g. tags or folders)
export const defaultListPageLayout: PageLayout = {
beforeBody: [Component.Breadcrumbs(breadcrumbsConfig), Component.ArticleTitle()],
left: [
Component.PageTitle(),
Component.MobileOnly(Component.Spacer()),
Component.MobileOnly(Component.OverlayExplorer()),
Component.Row([
Component.Map(),
Component.Darkmode(),
Component.Search(),
]),
Component.FloatingButtons({position: 'right'}),
],
right: [
Component.HiddenGlobalGraph(graphConfig),
],
}