Jacky Zhao
2025-03-13 696403d3fa79f79fa3340bb1fe11533d1fdaf0a4
quartz/plugins/emitters/aliases.ts
@@ -6,9 +6,6 @@
export const AliasRedirects: QuartzEmitterPlugin = () => ({
  name: "AliasRedirects",
  getQuartzComponents() {
    return []
  },
  async getDependencyGraph(ctx, content, _resources) {
    const graph = new DepGraph<FilePath>()
@@ -21,16 +18,13 @@
    return graph
  },
  async emit(ctx, content, _resources): Promise<FilePath[]> {
    const { argv } = ctx
    const fps: FilePath[] = []
  async *emit(ctx, content, _resources) {
    for (const [_tree, file] of content) {
      const ogSlug = simplifySlug(file.data.slug!)
      for (const slug of file.data.aliases ?? []) {
        const redirUrl = resolveRelative(slug, file.data.slug!)
        const fp = await write({
        yield write({
          ctx,
          content: `
            <!DOCTYPE html>
@@ -47,10 +41,7 @@
          slug,
          ext: ".html",
        })
        fps.push(fp)
      }
    }
    return fps
  },
})