jackyzha0 / quartz

🌱 a fast, batteries-included static-site generator that transforms Markdown content into fully functional websites
https://quartz.jzhao.xyz
MIT License
6.75k stars 2.45k forks source link

Click folder name to bring you to the index, ">" to expand the folder #606

Closed thelulzy closed 10 months ago

thelulzy commented 10 months ago

Is your feature request related to a problem? Please describe. Right now I don't think there's any way to navigate to an index file unless you have a link to it (or manually enter the directory's URL). Previously I thought the index file used to appear within the folder in quartz, but this does not currently seem to be the case.

Describe the solution you'd like When clicking on the name of the directory you are brought to the index. When clicking on the ">" to the left of the directory name the directory is expanded.

jackyzha0 commented 10 months ago

You can set the folderClickBehavior to "link" in the explorer: https://quartz.jzhao.xyz/features/explorer#customization

thelulzy commented 9 months ago

You can set the folderClickBehavior to "link" in the explorer: https://quartz.jzhao.xyz/features/explorer#customization

This is my first attempt at layout modification... The behavior doesn't seem to change when I append the Component.Explorer with folderClickBehavior changed as described. Am I doing something wrong?

import { PageLayout, SharedLayout } from "./quartz/cfg"
import * as Component from "./quartz/components"

// components shared across all pages
export const sharedPageComponents: SharedLayout = {
  head: Component.Head(),
  header: [],
  footer: Component.Footer({
    links: {
      GitHub: "https://github.com/thelulzy/TF-EE-quartz-obsidian-vault",
      "Discord Community": "https://discord.gg/thefinals",
    },
  }),
}

// 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(),
  ],
}

// components for pages that display lists of pages  (e.g. tags or folders)
export const defaultListPageLayout: PageLayout = {
  beforeBody: [Component.ArticleTitle()],
  left: [
    Component.PageTitle(),
    Component.MobileOnly(Component.Spacer()),
    Component.Search(),
    Component.Darkmode(),
  ],
  right: [],
}

Component.Explorer({
  folderClickBehavior: "link", // what happens when you click a folder ("link" to navigate to folder page on click or "collapse" to collapse folder on click)
})

Ran npx quartz build --serve after modifying the layout to test locally.