-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
AliasRedirects not working when files are moved into folders #904
Comments
Alias redirects are relative to the full path, I use nested aliases in my own content and it works fine. Note that aliases are relative to the note and not absolute |
I want to use aliases but I don't understand how should I write them.
How do I use nested aliases? I tried setting an alias like Update: I've realized how is it supposed to work, the alias is relative to the note, so if you want to redirect from |
This is kind of hacky, but I haven't found a better way to augment `allSlugs` - we need to have markdown parsed to get aliases from the frontmatter, and we need to add the slugs before links get transformed in the html plugin pass. Fixes jackyzha0#904, don't know why you closed that
Compute the alias FullSlugs in the frontmatter transformer and add them to `allSlugs` there. Also store them in file data to avoid recomputing them when emitting alias redirect pages. `allSlugs` need to be augmented before the html transformer resolves the links, hence the move to the markdown transformer. Fixes jackyzha0#904
With markdownLinkResolution: "shortest", aka "+/- how Obsidian does it" and given pages A and nested/B which has an alias Z, if you try to link from A using [[Z]] it wouldn't work and get 404. This is caused by alias slugs (nested/Z in this case, emitted by AliasRedirects) not being present in the `allSlugs` list which is used by the link transformer. The fix is to compute the alias slugs in the frontmatter transformer and add them to `allSlugs` there. Also we store them in file data to avoid recomputing them when emitting alias redirect pages. Fixes jackyzha0#904 Note: given how currently the markdown/html transformers are ordered this doesn't really work. Given pages A and nested/B which has an alias Z, here's the order which currently happens: md-transformers(A) => html-transformers(A) => md-transformers(B) => html-transformers(B) Since the nested/Z slug will get added when md-transformers(B) are run, but the slugs are used by html-transformers(A) when resolving it's links - the link [[Z]] in A will still 404 A fix for this is to split the parser into two stages - first apply the md-transformers to all files, and only then apply html-transformers to all files. I did just that in a different commit, which is needed for this one to work correctly.
With markdownLinkResolution: "shortest", aka "+/- how Obsidian does it" and given pages A and nested/B which has an alias Z, if you try to link from A using [[Z]] it wouldn't work and get 404. This is caused by alias slugs (nested/Z in this case, emitted by AliasRedirects) not being present in the `allSlugs` list which is used by the link transformer. The fix is to compute the alias slugs in the frontmatter transformer and add them to `allSlugs` there. Also we store them in file data to avoid recomputing them when emitting alias redirect pages. Fixes jackyzha0#904 Note: given how currently the markdown/html transformers are ordered this doesn't really work. Given pages A and nested/B which has an alias Z, here's the order which currently happens: md-transformers(A) => html-transformers(A) => md-transformers(B) => html-transformers(B) Since the nested/Z slug will get added when md-transformers(B) are run, but the slugs are used by html-transformers(A) when resolving it's links - the link [[Z]] in A will still 404 A fix for this is to split the parser into two stages - first apply the md-transformers to all files, and only then apply html-transformers to all files. I did just that in a different commit, which is needed for this one to work correctly.
With markdownLinkResolution: "shortest", aka "+/- how Obsidian does it" and given pages A and nested/B which has an alias Z, if you try to link from A using [[Z]] it wouldn't work and get 404. This is caused by alias slugs (nested/Z in this case, emitted by AliasRedirects) not being present in the `allSlugs` list which is used by the link transformer. The fix is to compute the alias slugs in the frontmatter transformer and add them to `allSlugs` there. Also we store them in file data to avoid recomputing them when emitting alias redirect pages. Fixes jackyzha0#904 Note: given how currently the markdown/html transformers are ordered this doesn't really work. Given pages A and nested/B which has an alias Z, here's the order which currently happens: md-transformers(A) => html-transformers(A) => md-transformers(B) => html-transformers(B) Since the nested/Z slug will get added when md-transformers(B) are run, but the slugs are used by html-transformers(A) when resolving it's links - the link [[Z]] in A will still 404 A fix for this is to split the parser into two stages - first apply the md-transformers to all files, and only then apply html-transformers to all files. I did just that in a different commit, which is needed for this one to work correctly.
With markdownLinkResolution: "shortest", aka "+/- how Obsidian does it" and given pages A and nested/B which has an alias Z, if you try to link from A using [[Z]] it wouldn't work and get 404. This is caused by alias slugs (nested/Z in this case, emitted by AliasRedirects) not being present in the `allSlugs` list which is used by the link transformer. The fix is to compute the alias slugs in the frontmatter transformer and add them to `allSlugs` there. Also we store them in file data to avoid recomputing them when emitting alias redirect pages. Fixes jackyzha0#904 Note: given how currently the markdown/html transformers are ordered this doesn't really work. Given pages A and nested/B which has an alias Z, here's the order which currently happens: md-transformers(A) => html-transformers(A) => md-transformers(B) => html-transformers(B) Since the nested/Z slug will get added when md-transformers(B) are run, but the slugs are used by html-transformers(A) when resolving it's links - the link [[Z]] in A will still 404 A fix for this is to split the parser into two stages - first apply the md-transformers to all files, and only then apply html-transformers to all files. I did just that in a different commit, which is needed for this one to work correctly.
With markdownLinkResolution: "shortest", aka "+/- how Obsidian does it" and given pages A and nested/B which has an alias Z, if you try to link from A using [[Z]] it wouldn't work and get 404. This is caused by alias slugs (nested/Z in this case, emitted by AliasRedirects) not being present in the `allSlugs` list which is used by the link transformer. The fix is to compute the alias slugs in the frontmatter transformer and add them to `allSlugs` there. Also we store them in file data to avoid recomputing them when emitting alias redirect pages. Fixes jackyzha0#904 Note: given how currently the markdown/html transformers are ordered this doesn't really work. Given pages A and nested/B which has an alias Z, here's the order which currently happens: md-transformers(A) => html-transformers(A) => md-transformers(B) => html-transformers(B) Since the nested/Z slug will get added when md-transformers(B) are run, but the slugs are used by html-transformers(A) when resolving it's links - the link [[Z]] in A will still 404 A fix for this is to split the parser into two stages - first apply the md-transformers to all files, and only then apply html-transformers to all files. I did just that in a different commit, which is needed for this one to work correctly.
With markdownLinkResolution: "shortest", aka "+/- how Obsidian does it" and given pages A and nested/B which has an alias Z, if you try to link from A using [[Z]] it wouldn't work and get 404. This is caused by alias slugs (nested/Z in this case, emitted by AliasRedirects) not being present in the `allSlugs` list which is used by the link transformer. The fix is to compute the alias slugs in the frontmatter transformer and add them to `allSlugs` there. Also we store them in file data to avoid recomputing them when emitting alias redirect pages. Fixes jackyzha0#904 Note: given how currently the markdown/html transformers are ordered this doesn't really work. Given pages A and nested/B which has an alias Z, here's the order which currently happens: md-transformers(A) => html-transformers(A) => md-transformers(B) => html-transformers(B) Since the nested/Z slug will get added when md-transformers(B) are run, but the slugs are used by html-transformers(A) when resolving it's links - the link [[Z]] in A will still 404 A fix for this is to split the parser into two stages - first apply the md-transformers to all files, and only then apply html-transformers to all files. I did just that in a different commit, which is needed for this one to work correctly.
Describe the bug
A clear and concise description of what the bug is.
Aliases in the YAML frontmatter seem to stop working when files are moved into folders.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Alias redirect should work properly when moving files in folders.
Screenshots and Source
NA
Desktop (please complete the following information):
node
Version: v19.4.0npm
version: v9.6.7Additional context
NA
The text was updated successfully, but these errors were encountered: