Skip to content

Conversation

@idencosmos
Copy link

Summary

  • skip generating redirect pages when the alias resolves to the same simplified slug as the source
  • prevent alias redirects that pointed back to themselves from causing infinite loops at runtime

@github-actions
Copy link

github-actions bot commented Sep 16, 2025

built with Refined Cloudflare Pages Action

⚡ Cloudflare Pages Deployment

Name Status Preview Last Commit
quartz ✅ Ready (View Log) Visit Preview 97bd330

@aarnphm
Copy link
Collaborator

aarnphm commented Sep 24, 2025

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?

@saberzero1
Copy link
Collaborator

saberzero1 commented Sep 24, 2025

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:

  • Duplicate aliases cause issues.
  • Setting the permalink to one of the aliases causes issues.
  • Aliases pointing to an existing file cause issues.

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.

@idencosmos
Copy link
Author

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?

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.

@aarnphm
Copy link
Collaborator

aarnphm commented Sep 28, 2025

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.

This makes sense, but we will sacrifice build time then.

@saberzero1
Copy link
Collaborator

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.

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.

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.

3 participants