Cannot Include Text and Link in the same Text Property Value

What I’m trying to do

In a text property value, I try to include a link to an existing note as well as othe information. For example: “[[Note 1]] - some interesting thoughts about this topic.”
I am able to have a text property only contain a link to another note. Or include text. But not both. I expected to be able to do both so I do not know if this is a bug or a feature request. It seems like a text field should allow for links and text since text generally means freeform text and Obsidian understands links in property values. I would expect it to act the same way links inserted into normal text behave.

Things I have tried

I have tried to insert the link various ways and then add some text. I am unable to do so.

3 Likes

As far as I know, this is the expected behavior :blush: : You can’t have a mix of a text value and a link tied to the same text property key.

Properties are designed to make it easy for plugins to extract and update values.

I think the correct way to approach your requirement would be to have two fields:

link: "[[Note link]]"
link_comments: "Some interesting thoughts about this topic"

These could also be arrays if you want to have multiple links and comments.

2 Likes

But is there a reason that links within text makes it more difficult for plugins to extract and update values :thinking: It seems like text should be text and if there is a link in that text it shouldnt make any difference in a text field.

Yes: for a plugin to do that it would need to parse the string to extract which part is the text part and which part is the link.

That’s exactly what the YAML frontmatter is for - it’s already parsed into a standardised format so that plugins and other software can use the values.

I found this topic as I was trying to do the same as @Spduck.

Assuming that it should be possible to set the value of a text property to any text, it seems rather arbitrary that a single link is treated as a link whilst a link + text or multiple links are not. I could understand if all links were treated as links, or if no links were treated as links, but implementing different behaviour depending on the value seems confused.

The current behaviour might be better implemented with a separate dedicated ‘link’ property type and then having the text property type ignore all links.

IMHO, from a user’s perspective, a better implementation would simply be to treat all links in a text property as links.

2 Likes

I ran into the same issue. I used it extensively until I found out it failed to work as intuitively imagined.

Examples:

---
address: "Copenhagenstreet 463, 2345BE, [[The Hague]]"
date: "[[1994]]-04-16"
---

Now I had to split the address in two fields and duplicated the city information like:

---
address:  "Copenhagenstreet 463, 2345BE, The Hague"
city: "[[The Hague]]"
birth_year: "[[1994]]"
date_of_birth: 1994-04-16
---

I understand the data type consistancy, but agree with Maread99 that “text” is “text” just like any other “text” in the node. Maybe add a “link” type?
That it happens to be text in the frontmatter does not explain the different behavior. Exactly the same issue occurs with tags that don’t work as expected and are suddenly restructured when providing them for the “tags” property, breaking the “no vender lock” promise since tags are a general concept and handled in a special way.

Not only is there a difference between a text and a link property, but there is also a difference between plain text and markdown text. If there was a change from properties being plain text, into accepting markdown syntax, I would agree that also links should work.

But if I’m not mistaken, the current text properties are plain text properties, and as such I find it not natural for it to be considered for markdown syntax. It’s very easy to say that it text should be able to contain markdown and/or links, but it’ll also generate a lot of extra difficulties related to formatting and link handling in general.

On a side note, if you use text properties and present them within a Dataview query, then they’ll be parsed as markdown. This means that links would be presented as links, although without generating backlinks, being renamed if the links are renamed, and so on.

2 Likes