Skip to content

Conversation

@sonu27
Copy link

@sonu27 sonu27 commented Nov 5, 2025

This pull request adds robust support for permalinks in Quartz, allowing pages to be rendered at custom URLs while maintaining correct internal navigation, backlinks, breadcrumbs, tag links, and redirects. It ensures that if a page specifies a permalink in its frontmatter, all generated links and references use the permalink instead of the default file-based slug. The documentation is also updated to clarify the distinction between aliases and permalinks.

This PR was written entirely using an LLM.

@github-actions
Copy link

github-actions bot commented Nov 5, 2025

built with Refined Cloudflare Pages Action

⚡ Cloudflare Pages Deployment

Name Status Preview Last Commit
quartz ✅ Ready (View Log) Visit Preview 84d6484

@saberzero1 saberzero1 changed the title fix: correct permalink and alias behavior to match Obsidian fix(links): correct permalink and alias behavior to match Obsidian Nov 6, 2025
@sonu27
Copy link
Author

sonu27 commented Nov 11, 2025

Any thoughts @jackyzha0 ?

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request implements comprehensive permalink support in Quartz, allowing pages to be rendered at custom URLs while ensuring all internal links, navigation components, and metadata use the permalink instead of the default file-based slug. The implementation correctly handles redirects from original file paths to permalinks and updates documentation to clarify the distinction between aliases and permalinks.

Key Changes:

  • Added permalinkSlug tracking throughout the system with a slugToPermalink map in build context
  • Updated all components and emitters to use permalink-aware linking via a new getDisplaySlug helper function
  • Modified frontmatter processing to treat permalinks as the primary rendering target with automatic redirect creation

Reviewed Changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
quartz/util/path.ts Added getDisplaySlug helper to choose between permalink and regular slug
quartz/util/ctx.ts Extended BuildCtx with slugToPermalink mapping for permalink lookups
quartz/processors/parse.ts Passes slugToPermalink map to parsing context
quartz/plugins/transformers/links.ts Rewrites internal link hrefs to use permalinks when available
quartz/plugins/transformers/frontmatter.ts Processes permalink frontmatter and creates redirect from original path
quartz/plugins/emitters/ogImage.tsx Uses permalink for OG image generation
quartz/plugins/emitters/contentPage.tsx Renders pages at permalink URL instead of file path
quartz/plugins/emitters/contentIndex.tsx Includes displaySlug in content index for sitemap/RSS
quartz/plugins/emitters/aliases.ts Redirects aliases to permalink URL when set
quartz/components/scripts/explorer.inline.ts Updates explorer navigation to use permalink-aware links
quartz/components/pages/TagContent.tsx Uses permalink for tag page links
quartz/components/TagList.tsx Uses permalink for tag navigation
quartz/components/RecentNotes.tsx Uses permalink for recent notes links
quartz/components/PageList.tsx Uses permalink for page list links
quartz/components/Breadcrumbs.tsx Uses permalink for breadcrumb navigation
quartz/components/Backlinks.tsx Uses permalink for backlink references
quartz/build.ts Builds and maintains slugToPermalink map during build and rebuild
docs/plugins/AliasRedirects.md Documents permalink vs alias behavior with examples

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sonu27
Copy link
Author

sonu27 commented Nov 16, 2025

@saberzero1 Some of the copilot suggestions were not correct and broke the types, so reverted those.

Any other blockers?

@sonu27
Copy link
Author

sonu27 commented Dec 6, 2025

Or things preventing this from being merged?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant