--- title: Layout --- Certain emitters may also output [HTML](https://developer.mozilla.org/en-US/docs/Web/HTML) files. To enable easy customization, these emitters allow you to fully rearrange the layout of the page. In v5, the layout is defined in `quartz.config.yaml` using a `defaults` + `byPageType` structure. - `defaults` contains layout components shared across ALL page types (head, header, afterBody, footer). - `byPageType` contains per-page-type overrides (content, folder, tag, 404) for beforeBody, left, right sections, and optionally a `template` to control the page's [[#Page Frames|page frame]]. Each page is composed of multiple different sections which contain `QuartzComponents`. The following code snippet lists all of the valid sections that you can add components to: ```typescript title="quartz/cfg.ts" export interface FullPageLayout { head: QuartzComponent // single component header: QuartzComponent[] // laid out horizontally beforeBody: QuartzComponent[] // laid out vertically pageBody: QuartzComponent // single component afterBody: QuartzComponent[] // laid out vertically left: QuartzComponent[] // vertical on desktop and tablet, horizontal on mobile right: QuartzComponent[] // vertical on desktop, horizontal on tablet and mobile footer: QuartzComponent // single component } ``` These correspond to following parts of the page: | Layout | Preview | | ------------------------------- | ----------------------------------- | | Desktop (width > 1200px) | ![[quartz-layout-desktop.png\|800]] | | Tablet (800px < width < 1200px) | ![[quartz-layout-tablet.png\|800]] | | Mobile (width < 800px) | ![[quartz-layout-mobile.png\|800]] | > [!note] > There are two additional layout fields that are _not_ shown in the above diagram. > > 1. `head` is a single component that renders the `
` [tag](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/head) in the HTML. This doesn't appear visually on the page and is only is responsible for metadata about the document like the tab title, scripts, and styles. > 2. `header` is a set of components that are laid out horizontally and appears _before_ the `beforeBody` section. This enables you to replicate the old Quartz 3 header bar where the title, search bar, and dark mode toggle. By default, Quartz doesn't place any components in the `header`. Layout components are configured in the `layout` section of `quartz.config.yaml`. Plugins declare their position and priority, and the layout system arranges them automatically: ```yaml title="quartz.config.yaml" plugins: - source: github:quartz-community/explorer enabled: true layout: position: left priority: 50 - source: github:quartz-community/graph enabled: true layout: position: right priority: 10 - source: github:quartz-community/search enabled: true layout: position: left priority: 20 - source: github:quartz-community/backlinks enabled: true layout: position: right priority: 30 - source: github:quartz-community/article-title enabled: true layout: position: beforeBody priority: 10 - source: github:quartz-community/content-meta enabled: true layout: position: beforeBody priority: 20 - source: github:quartz-community/tag-list enabled: true layout: position: beforeBody priority: 30 - source: github:quartz-community/footer enabled: true options: links: GitHub: https://github.com/jackyzha0/quartz Discord Community: https://discord.gg/cRFFHYye7t layout: groups: toolbar: direction: row gap: 0.5rem byPageType: content: {} folder: exclude: - reader-mode positions: right: [] tag: exclude: - reader-mode positions: right: [] "404": positions: beforeBody: [] left: [] right: [] ``` For advanced layout overrides using TypeScript (e.g. custom component wrappers or conditional logic), you can use the TS override in `quartz.ts`: ```ts title="quartz.ts" import { loadQuartzConfig, loadQuartzLayout } from "./quartz/plugins/loader/config-loader" const config = await loadQuartzConfig() export default config export const layout = await loadQuartzLayout({ defaults: { // override default layout for all page types }, byPageType: { content: { // override layout for content pages only }, folder: { // override layout for folder pages only }, }, }) ``` Fields defined in `defaults` can be overridden by specific entries in `byPageType`. Community component plugins are installed via `npx quartz plugin add github:quartz-community/