local and global graph
This commit is contained in:
		@@ -14,19 +14,20 @@ const defaultOptions: Options = {
 | 
			
		||||
  indexExternalLinks: false,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type ContentIndex = Map<string, {
 | 
			
		||||
export type ContentIndex = Map<string, ContentDetails> 
 | 
			
		||||
export type ContentDetails = {
 | 
			
		||||
  title: string,
 | 
			
		||||
  links?: string[],
 | 
			
		||||
  tags?: string[],
 | 
			
		||||
  content: string,
 | 
			
		||||
}> 
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export const ContentIndex: QuartzEmitterPlugin<Options> = (userOpts) => {
 | 
			
		||||
  const opts = { ...userOpts, ...defaultOptions }
 | 
			
		||||
  return {
 | 
			
		||||
    name: "ContentIndex",
 | 
			
		||||
    async emit(_contentDir, _cfg, content, _resources, emit) {
 | 
			
		||||
      const fp = "contentIndex"
 | 
			
		||||
      const fp = path.join("static", "contentIndex")
 | 
			
		||||
      const linkIndex: ContentIndex = new Map()
 | 
			
		||||
      for (const [tree, file] of content) {
 | 
			
		||||
        let slug = trimPathSuffix(file.data.slug!)
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@ import { JSResourceToScriptElement, StaticResources } from "../../resources"
 | 
			
		||||
import { QuartzEmitterPlugin } from "../types"
 | 
			
		||||
import { render } from "preact-render-to-string"
 | 
			
		||||
import { QuartzComponent } from "../../components/types"
 | 
			
		||||
import { resolveToRoot } from "../../path"
 | 
			
		||||
import { resolveToRoot, trimPathSuffix } from "../../path"
 | 
			
		||||
import HeaderConstructor from "../../components/Header"
 | 
			
		||||
import { QuartzComponentProps } from "../../components/types"
 | 
			
		||||
import BodyConstructor from "../../components/Body"
 | 
			
		||||
@@ -56,7 +56,7 @@ export const ContentPage: QuartzEmitterPlugin<Options> = (opts) => {
 | 
			
		||||
        const Content = opts.content
 | 
			
		||||
        const doc = <html>
 | 
			
		||||
          <Head {...componentData} />
 | 
			
		||||
          <body data-slug={file.data.slug}>
 | 
			
		||||
          <body data-slug={trimPathSuffix(file.data.slug ?? "")}>
 | 
			
		||||
            <div id="quartz-root" class="page">
 | 
			
		||||
              <Header {...componentData} >
 | 
			
		||||
                {header.map(HeaderComponent => <HeaderComponent {...componentData} />)}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user