Skip to content
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

Enable linking to files via aliases #92

Open
j-steinbach opened this issue Aug 11, 2020 · 14 comments
Open

Enable linking to files via aliases #92

j-steinbach opened this issue Aug 11, 2020 · 14 comments
Labels

Comments

@j-steinbach
Copy link

I try to replace Quoll with Dendron/Roam.

The single most featue I am missing is being able to create aliases for files, which I then can link to.

For example I write "is [[death]] just another journey?" and it points me to death.md.

Now in a different document I exclaim: "and so he went on his [[final journey]]. I don't want this to point to final journey.md, I also want it to link to death.md.

Furthermore, I don't want to write it as [[final journey|death]]:

  • It takes me out of my flow:
  • It makes me validate my thoughts up-front. What exactly did I mean by "final journey"? Where exactly do I want to link it to? Do I really want to link it to death?
  • It doesn't let me discover what my previous-me thought about it -> I want to "converse with my second brain"
  • It burdenes me with having to create the connection manually, i.e. linking to death.md.
  • I don't want to write so many words.. :)

From a technical perspective, I don't imagine it to be difficult. AFAIK, Dendron already uses YAML-Frontmatter, so adding an "alias"-field there and updating the link database should to the trick - not that I actually know what I am talking about :)

@kevinslin
Copy link
Member

so implementing aliases is a little bit more involved just because there's lots of ways a file can be opened (eg. clicking link in preview, using lookup, going to definition, another extension)

i've put together a prototype that will check if a note is an alias and if so, open up the note its pointing to. currently there's a slight flicker because we actually open and then close the original document before opening the alias:

the alias is defined in a schema file with an alias field. would something like this work for your use case?

@j-steinbach
Copy link
Author

j-steinbach commented Aug 11, 2020

Thanks for the fast reply! It seems workable, but I would not call it perfect.. (yeah, yeah, beggars choosers)

Ideally, it would allow me to either write the alias directly to the target (death.md), or allow me to manage all my aliases in a central file. As I understand your implementation, I would have to create an alias file for each alias (and who says that we stop at one alias?).

Also, I am concerned about the flickering. It kinda works for me, but if it gets added to the master, outsiders* might take it as a a bug. I am also a bit worried about unintended results the opening and closing might have - for example, the creation might trigger some code cleanup or beautifer (Beautifer, Prettier) and misbehave. Now that I think about it, I run like 30 something extensions. I can't be sure if this won't trigger some erratic behaviour.

If this is too much trouble, I am completely fine with you shelving the issue until more people become aware.

*people that do not know about this this issue/conversation

@kevinslin
Copy link
Member

yeah, definitely not perfect. i'm going to do some thinking on this. i do want to support the ability for aliases in the future but also need to consider the ux.

i'm hesitant to make alias configurable on the note frontmatter because if a note is an alias and always navigates to the note that its pointing it to, how do you edit the alias note after the fact?

i think aliases will be defined in either one of two places:

  • the dendron.yml file which is currently used to specify dendron publishing values
  • a global schema.yml file you can use to define aliases

leaning towards putting aliases inside dendron.yml but will spend some time thinking about it. as for the flickering, what we might do to start off with is only enable aliases when you navigate by shortcut. we can slowly add alias support in other parts as they come up (eg. via the preview and the lookup)

@j-steinbach
Copy link
Author

That sounds like a plan.
Wait, what exactly do you mean with "if a note is an alias". Isn't a note a file that contains links?

  • A hero's journey.md contains a sentence called "and so he went on his [[final journey]]".
  • death.md contains some frontmatter like: "alias: final journey".

If I navigate the link [[final journey]] it leads me to death.md where I can easily edit the alias again.

@kevinslin
Copy link
Member

ah, i see. that would work.

I was thinking of having a file called final journey.md with the following frontmatter.

---
alias: death.md
---

what you are saying is much more sensible 😅

@j-steinbach
Copy link
Author

Great, and sorry for the confusion. Explaining things in text is hard... But I think we got there. The whole point of this is to not have a file called final journey.md :)

@funkotron
Copy link

This may be possible with symlinks on UNIX based operating systems (Mac OS X and linux)

@kevinslin
Copy link
Member

Symlinks can work - only issue is that it won't be portable across computers (eg. if you commit to git/dropbox, you will lose the symlink)

@boticello
Copy link

As I'm sure you're aware, this is available in Obsidian, and the UX works very nicely. It's the one feature that is holding me back from using Dendron. It's good to hear that you're thinking it through thoroughly. Symlinks would be a bad solution for me, for the reason you say – it will break across machines and in git repos. Looking forward to seeing the Dendron solution.

@Heniker
Copy link

Heniker commented Mar 3, 2021

According to this stackoverflow answer, git can handle symlinks correctly. But implementing a symlink solution will require some special directory, under which real files should be kept (to prevent issues with broken symlinks). And, perhaps some mechanism to detect files that should be symlinks, but are not (e.g. because workspace was backed up to cloud storage that doesn't support symlinks).
Alternatively, if it's okay to duplicate files, it might make sense to create an actual copy of a file and update all of it's aliases once one of the copies changes. This would require to add original file name to it's own aliases.

@kevinslin
Copy link
Member

Thanks for the update. The way we're planning on handling symlinks is the same way Obsidian is doing it. Just haven't been able to find bandwidth to work on this feature yet. Will highlight this in our dev channel to see if someone wants to jump on this.

@TaxDevOp
Copy link

TaxDevOp commented May 5, 2022

Hmmm... i guess not... 1 year gone since last update and still no solution.

@TaxDevOp
Copy link

TaxDevOp commented Mar 4, 2023

Hmmm... again nearly a year gone and still nothing happened....

@alexandrupetrini
Copy link

alexandrupetrini commented Mar 6, 2023

Hmmm... again nearly a year gone and still nothing happened....

Dendron in no longer in active development, see here:
https://discordapp.com/channels/717965437182410783/737323300967022732/1072563304289030164

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants