From 56a1b7690a4ae11fa6581a19b17cd36d8b2495eb Mon Sep 17 00:00:00 2001 From: nhannht Date: Tue, 7 May 2024 20:58:53 +0700 Subject: [PATCH] doc: trying new `giscus` component --- quartz.config.ts | 169 +++++++++++++++++++++++++---------------------- quartz.layout.ts | 79 +++++++++++----------- 2 files changed, 130 insertions(+), 118 deletions(-) diff --git a/quartz.config.ts b/quartz.config.ts index 028c807..833d79f 100644 --- a/quartz.config.ts +++ b/quartz.config.ts @@ -1,5 +1,5 @@ // @ts-ignore -import { QuartzConfig } from "./quartz/cfg" +import {QuartzConfig} from "./quartz/cfg" // @ts-ignore import * as Plugin from "./quartz/plugins" @@ -9,86 +9,95 @@ import * as Plugin from "./quartz/plugins" * See https://quartz.jzhao.xyz/configuration for more information. */ const config: QuartzConfig = { - configuration: { - pageTitle: "HISTORICA", - enableSPA: true, - enablePopovers: true, - analytics: { + configuration: { + pageTitle: "HISTORICA", + enableSPA: true, + enablePopovers: true, + discussion: { + provider: "giscus", + configure: { + dataRepo: "nhannht/obsidian-historica", + dataRepoId: "R_kgDOLWDFnQ", + dataCategory: "Comments from documents", + dataCategoryId: "DIC_kwDOLWDFnc4CfMZ6", + } + }, + analytics: { // @ts-ignore - provider: null, - }, - locale: "en-US", - baseUrl: "https://historica.pages.dev", - ignorePatterns: ["private", "templates", ".obsidian"], - defaultDateType: "created", - theme: { - fontOrigin: "googleFonts", - cdnCaching: true, - typography: { - header: "Cinzel Decorative", - body: "Lora", - code: "Jetbrains Mono", - }, - colors: { - lightMode: { - light: "#ffffff", - lightgray: "#e5e5e5", - gray: "#b8b8b8", - darkgray: "#4e4e4e", - dark: "#2b2b2b", - secondary: "#ea1717", - tertiary: "#84a59d", - highlight: "rgb(250,231,234)", - }, - darkMode: { - light: "#161618", - lightgray: "#393639", - gray: "#646464", - darkgray: "#d4d4d4", - dark: "#ebebec", - secondary: "#7b97aa", - tertiary: "#84a59d", - highlight: "rgba(143, 159, 169, 0.15)", - }, - }, - }, - }, - plugins: { - transformers: [ - Plugin.FrontMatter(), - Plugin.CreatedModifiedDate({ - priority: ["frontmatter", "filesystem"], - }), - Plugin.Latex({ renderEngine: "katex" }), - Plugin.SyntaxHighlighting({ - theme: { - light: "github-light", - dark: "github-dark", - }, - keepBackground: false, - }), - Plugin.ObsidianFlavoredMarkdown({ enableInHtmlEmbed: false }), - Plugin.GitHubFlavoredMarkdown(), - Plugin.TableOfContents(), - Plugin.CrawlLinks({ markdownLinkResolution: "shortest" }), - Plugin.Description(), - ], - filters: [Plugin.RemoveDrafts()], - emitters: [ - Plugin.AliasRedirects(), - Plugin.ComponentResources(), - Plugin.ContentPage(), - Plugin.FolderPage(), - Plugin.TagPage(), - Plugin.ContentIndex({ - enableSiteMap: true, - enableRSS: true, - }), - Plugin.Assets(), - Plugin.Static(), - Plugin.NotFoundPage(), - ], - }, + provider: null, + }, + locale: "en-US", + baseUrl: "https://historica.pages.dev", + ignorePatterns: ["private", "templates", ".obsidian"], + defaultDateType: "created", + theme: { + fontOrigin: "googleFonts", + cdnCaching: true, + typography: { + header: "Cinzel Decorative", + body: "Lora", + code: "Jetbrains Mono", + }, + colors: { + lightMode: { + light: "#ffffff", + lightgray: "#e5e5e5", + gray: "#b8b8b8", + darkgray: "#4e4e4e", + dark: "#2b2b2b", + secondary: "#ea1717", + tertiary: "#84a59d", + highlight: "rgb(250,231,234)", + }, + darkMode: { + light: "#161618", + lightgray: "#393639", + gray: "#646464", + darkgray: "#d4d4d4", + dark: "#ebebec", + secondary: "#7b97aa", + tertiary: "#84a59d", + highlight: "rgba(143, 159, 169, 0.15)", + }, + }, + }, + }, + plugins: { + transformers: [ + Plugin.FrontMatter(), + Plugin.CreatedModifiedDate({ + priority: ["frontmatter", "filesystem"], + }), + Plugin.Latex({renderEngine: "katex"}), + Plugin.SyntaxHighlighting({ + theme: { + light: "github-light", + dark: "github-dark", + }, + keepBackground: false, + }), + Plugin.ObsidianFlavoredMarkdown({enableInHtmlEmbed: false}), + Plugin.GitHubFlavoredMarkdown(), + Plugin.TableOfContents(), + Plugin.CrawlLinks({markdownLinkResolution: "shortest"}), + Plugin.Description(), + ], + filters: [Plugin.RemoveDrafts()], + emitters: [ + Plugin.AliasRedirects(), + Plugin.ComponentResources(), + Plugin.ContentPage(), + Plugin.FolderPage(), + Plugin.TagPage(), + Plugin.ContentIndex({ + enableSiteMap: true, + enableRSS: true, + }), + Plugin.Assets(), + Plugin.Static(), + Plugin.NotFoundPage(), + ], + }, } export default config diff --git a/quartz.layout.ts b/quartz.layout.ts index d6d1599..ff7200b 100644 --- a/quartz.layout.ts +++ b/quartz.layout.ts @@ -1,53 +1,56 @@ // @ts-ignore -import { PageLayout, SharedLayout } from "./quartz/cfg" +import {PageLayout, SharedLayout} from "./quartz/cfg" // @ts-ignore import * as Component from "./quartz/components" // components shared across all pages export const sharedPageComponents: SharedLayout = { - head: Component.Head(), - header: [], - footer: Component.Footer( - { - links: { - "Source code": "https://github.com/nhannht/historica", - "RSS": "https://historica.pages.dev/index.xml" - , - }, - }), + head: Component.Head(), + header: [], + footer: Component.Footer( + { + links: { + "Source code": "https://github.com/nhannht/historica", + "RSS": "https://historica.pages.dev/index.xml" + , + }, + }), } // components for pages that display a single page (e.g. a single note) export const defaultContentPageLayout: PageLayout = { - beforeBody: [ - Component.Breadcrumbs(), - Component.ArticleTitle(), - Component.ContentMeta(), - Component.TagList(), - ], - left: [ - Component.PageTitle(), - Component.MobileOnly(Component.Spacer()), - Component.Search(), - Component.Darkmode(), - Component.DesktopOnly(Component.Explorer()), - ], - right: [ - Component.Graph(), - Component.DesktopOnly(Component.TableOfContents()), - Component.Backlinks(), - ], + beforeBody: [ + Component.Breadcrumbs(), + Component.ArticleTitle(), + Component.ContentMeta(), + Component.TagList(), + ], + left: [ + Component.PageTitle(), + Component.MobileOnly(Component.Spacer()), + Component.Search(), + Component.Darkmode(), + Component.DesktopOnly(Component.Explorer()), + ], + right: [ + Component.Graph(), + Component.DesktopOnly(Component.TableOfContents()), + Component.Backlinks(), + ], + footer: Component.Discussion() + + } // components for pages that display lists of pages (e.g. tags or folders) export const defaultListPageLayout: PageLayout = { - beforeBody: [Component.Breadcrumbs(), Component.ArticleTitle(), Component.ContentMeta()], - left: [ - Component.PageTitle(), - Component.MobileOnly(Component.Spacer()), - Component.Search(), - Component.Darkmode(), - Component.DesktopOnly(Component.Explorer()), - ], - right: [], + beforeBody: [Component.Breadcrumbs(), Component.ArticleTitle(), Component.ContentMeta()], + left: [ + Component.PageTitle(), + Component.MobileOnly(Component.Spacer()), + Component.Search(), + Component.Darkmode(), + Component.DesktopOnly(Component.Explorer()), + ], + right: [], }