Bug or user error? I can't get linkedFrom(this) to work in HTML export

I want to include a custom HTML template for each note that is linked from the currently exporting note. Here’s the relevant code:

^include(^value(find(linkedFrom(this)))^, /Templates/HTML page/my link)^

Unfortunately, I can’t get that working. If I hard-code the value, it works fine:

^include(^value(find(linkedFrom(/Notes/My Page/the source)))^, /Templates/HTML page/my link)^

I’ve tried:

  • this
  • that
  • original
  • current

None of them works.

Am I doing something wrong? Here’s a demo file. The two lines should be identical, but they’re not.

linkedFrom_this.tbx (60.7 KB)

This works – but the scope is probably too broad.

^include(^value(find(linkedFrom("*")))^, /Templates/HTML page/my link)^

[deleted] as more useful answer is in the next responder’s post.

This was a bit of a head-scratcher.

^value(find(linkedFrom(this)))

won’t work. In find(), this is bound to the note that find() is examining. So, this looks for notes that are linked to themselves. We want, instead:

^value(find(linkedFrom(that)))

Tinderbox rebinds that, you will recall, to whatever was bound to this outside the find(). expression.

But there was one thing they had forgotten. The need for that was recognized fairly late in the evolution of Tinderbox, and as a result, ^value() failed to set up the necessary mechanisms for using that inside export expressions. This will be fixed in the next update (7.1.1 b266 and later).

2 Likes

I suspected that would more likely be the correct one. Thanks for confirming.

That is great to hear :slight_smile:

1 Like