-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
fix(links): correct permalink and alias behavior to match Obsidian #2192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: v4
Are you sure you want to change the base?
Conversation
built with Refined Cloudflare Pages Action⚡ Cloudflare Pages Deployment
|
|
Any thoughts @jackyzha0 ? |
There was a problem hiding this 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
permalinkSlugtracking throughout the system with aslugToPermalinkmap in build context - Updated all components and emitters to use permalink-aware linking via a new
getDisplaySlughelper 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.
|
@saberzero1 Some of the copilot suggestions were not correct and broke the types, so reverted those. Any other blockers? |
|
Or things preventing this from being merged? |
247487a to
84d6484
Compare
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
permalinkin 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.