-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
fix: skip self-referential redirects #2129
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
|
|
i'm confused with this PR. "the alias resolves to the same simplified slug as the source" means you have the same alias as the file name? In this case can you just remove the alias? |
There is an underlying issue with permalinks and aliases:
I have made a PR in the past to align what a permalink is and what aliases are with Obsidian Publish, but they have since changed the definitions. What makes it worse is that what aliases are is not even consistent between Obsidian and Obsidian Publish. Anyway, we should probably address the issue raised in the PR a little differently. Namely, we should de-duplicate the links we get from the frontmatter. So the combination of the note's path, the aliases of that note, and the permalink of that note should contain no duplicates. |
If the alias is the same as the file name, removing it would be simple. But there’s no reliable way to verify this, and if they do happen to match, the page ends up in an infinite redirect loop, making it completely inaccessible. That’s why I think it would be good to add a small safeguard to prevent this issue. In my case, I accumulate the current file path in the aliases so that even if I rename or move the file, the old path remains accessible. Since this has to be recorded before the move happens, the file path and the slug can become the same — which is why I applied this patch. |
This makes sense, but we will sacrifice build time then. |
To be fair, this check can be done in its entirely during the frontmatter parsing. So impact on build time is negligible. |
Summary