| | |
| | | body: QuartzComponent[] |
| | | } |
| | | |
| | | export class ContentPage extends QuartzEmitterPlugin { |
| | | name = "ContentPage" |
| | | opts: Options |
| | | |
| | | constructor(opts: Options) { |
| | | super() |
| | | this.opts = opts |
| | | export const ContentPage: QuartzEmitterPlugin<Options> = (opts) => { |
| | | if (!opts) { |
| | | throw new Error("ContentPage must be initialized with options specifiying the components to use") |
| | | } |
| | | |
| | | getQuartzComponents(): QuartzComponent[] { |
| | | return [this.opts.head, Header, ...this.opts.header, ...this.opts.body] |
| | | } |
| | | |
| | | return { |
| | | name: "ContentPage", |
| | | getQuartzComponents() { |
| | | return [opts.head, Header, ...opts.header, ...opts.body] |
| | | }, |
| | | async emit(cfg: GlobalConfiguration, content: ProcessedContent[], resources: StaticResources, emit: EmitCallback): Promise<string[]> { |
| | | const fps: string[] = [] |
| | | |
| | | const { head: Head, header, body } = this.opts |
| | | const { head: Head, header, body } = opts |
| | | for (const [tree, file] of content) { |
| | | const baseDir = resolveToRoot(file.data.slug!) |
| | | const pageResources: StaticResources = { |
| | |
| | | <body> |
| | | <div id="quartz-root" class="page"> |
| | | <Header {...componentData} > |
| | | {header.map(HeaderComponent => <HeaderComponent {...componentData} position="header" />)} |
| | | {header.map(HeaderComponent => <HeaderComponent {...componentData} />)} |
| | | </Header> |
| | | <Body {...componentData}> |
| | | {body.map(BodyComponent => <BodyComponent {...componentData } position="body" />)} |
| | | {body.map(BodyComponent => <BodyComponent {...componentData} />)} |
| | | </Body> |
| | | </div> |
| | | </body> |
| | |
| | | return fps |
| | | } |
| | | } |
| | | } |