How do you get the text of a link? #1217
-
Motivation: I'm trying to create a template for a Map of Content. So, I want to find all the notes that have a link to So, I want to find links where the text of the link is "PopOS". Doing some debugging, I can see that I'm looking for a way of getting just the text of the link. I tried further experimenting with substring. With a note with some test links in it:
It seems that you could strip off the However the format of the string seems to rely on the format of the original link or whether the outgoing link points to a page that already exists or not. So, sometimes, the link is represented in the format |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Look at the |
Beta Was this translation helpful? Give feedback.
-
Thank you! This helped a lot!
So, the path contains the filename section I need, and it seems to do that pretty consistently. I did a few more tests with a selection of different links:
So, if the file doesn't exist, you just get a filename without the full path, or a file extension. I checked the
I double checked with Which seemed to work just fine. Finally, I wrote a regexreplace method to strip away the root path and extension, if there. This seems to get me what I need:
so my final dataview query is:
|
Beta Was this translation helpful? Give feedback.
Look at the
meta()
functions in the docs.meta(field).path
should give you what you need. Note that this may change in the near future.