quartz.layout.ts, which defines component placement across different page types. Layouts control where components like navigation, table of contents, and search appear on your pages.
Layout Structure
Quartz supports two layout configurations:- Shared Layout - Components that appear on all pages
- Page Layouts - Components specific to page types (content pages vs. list pages)
quartz.layout.ts
Shared Layout
Components inSharedLayout appear on every page of your site.
Structure
Content injected into the
<head> tag (meta tags, scripts, styles)Components displayed at the top of every page
Components displayed after the main content
Footer component at the bottom of every page
Example
quartz.layout.ts
The
Head component is required for proper page functionality. Always include it in the shared layout.Page Layouts
Page layouts define component placement for specific page types. Quartz uses a three-column grid:- left - Left sidebar (navigation, search)
- center - Main content area
- right - Right sidebar (table of contents, graph)
beforeBody components appear above the main content.
Content Page Layout
Used for individual pages like notes and articles.quartz.layout.ts
Component Breakdown
beforeBody (above content):Breadcrumbs- Navigation path (hidden on index page)ArticleTitle- Page title headingContentMeta- Metadata (dates, reading time)TagList- Tags associated with the page
PageTitle- Site title/logoSpacer- Spacing on mobile devicesFlex- Horizontal layout containing Search, Darkmode toggle, and ReaderModeExplorer- File tree navigation
Graph- Interactive graph view of connectionsTableOfContents- Page outline (desktop only)Backlinks- Pages linking to this page
List Page Layout
Used for tag pages, folder indexes, and other collection views.quartz.layout.ts
List pages typically have an empty right sidebar to provide more space for the content list.
Layout Components
Conditional Rendering
Show or hide components based on page properties:The component to conditionally render
Function that returns
true to show the component, false to hide itResponsive Components
Control component visibility by screen size:- Desktop Only
- Mobile Only
Flex Layout
Arrange components horizontally:Array of components with optional
grow propertyIf
true, the component expands to fill available spaceCommon Components
Navigation
Site title/logo, typically links to the homepage
Navigation path showing the page hierarchy
File tree navigation for browsing content structure
Content
Page heading (h1) displaying the page title
Metadata like creation date, modification date, and reading time
List of tags associated with the current page
Outline of page headings for quick navigation
Discovery
Full-text search across all content
Interactive visualization of page connections
List of pages that link to the current page
Utilities
Toggle between light and dark color schemes
Distraction-free reading mode
Empty space for layout purposes
Customizing Layouts
Adding a Component
To add a component to your layout:- Import the component (already done via
import * as Component) - Add it to the appropriate section:
Reordering Components
Simply change the order in the array:Removing a Component
Delete or comment out the component:Layout Examples
Minimal Layout
Minimal Layout
Documentation Layout
Documentation Layout
Digital Garden Layout
Digital Garden Layout
Best Practices
Keep it Balanced
Distribute components evenly across left and right sidebars to avoid overwhelming one side.
Mobile First
Use
MobileOnly and DesktopOnly to ensure good experience on all devices.Content Priority
Place most important navigation in the left sidebar where users look first.
Consistent Layouts
Maintain similar layouts between content and list pages for familiarity.
Related Configuration
Site Settings
Configure page title, locale, and behavior
Theme Configuration
Customize colors, fonts, and visual styling