Display Dynamic Content Based on Location Without Code Block

For my daily journals, the template that I use appends a Dataviewjs block at the end that calls a script to show me links to pictures and documents from that same day, and it works great. When viewing that journal outside of Obsidian, I know I can’t see those links, but it’s annoying to still see:

```dataviewjs
await dv.view("_Meta/Scripts/BaseFooter")
```

Is there a plugin or other method to tell obsidian to append the results of a script to the end of a displayed note (on the screen only, not to modify the .md file), so I can remove the block from my template and the note files, but still see the same results in Obsidian? I guess it would be something like a dynamic Dataview block, but instead of being triggered by ```dataviewjs it would know to always add it to the end of any file from a particular location. The logic would be “Oh, this note is in the Journals folder so I’m going to append the results of this script to the end of the note contents and display it all on the screen.”

You’d still need some md file to communicate the script on. Unless someone creates a plugin which would do outputs to a sidebar element…?

I’m not sure what the Note Toolbar plugin can do as I never delved into it. It can be fed scripts but I don’t think the results would be floated on top of a note…I’d be surprised but…maybe worth a look…

When I need something like this, I pin an md file tab on a sidebar, and it outputs various data dynamically, whether via Dataview or Datacore. That’s it.

I hadn’t considered using the sidebar, so that’s a possible option, but ideally the dynamic text and the note text would be combined and displayed as one in the notes window. I guess the most similar thing I can think of is how CSS can make a note display differently than the original markdown. I doubt you can have CSS run a script and insert the results, but that’s the most similar workflow I can see.

A few months ago I wanted something similar as you, on tablet. I wanted to have an html window that can be achieved with iOS Shortcuts floated on top of my Obsdian app. I never got around to doing anything with it.
I imagine some floating modal could be hacked with javascript or typescript, communicating with the Dataview API. It is worth a shot. I think Sonnet 3.7 at Claude can cook something up.

I’ve got two ideas for you. The first is, that if the other place to view your files is a published site, it should be possible to use CSS to hide the code block.

The other idea is that the plugin Nav Link Header is doing something similar. It adds navigation links in the header (before the note content), and there is no trace within the file of the header. You could look at that, and see if you could adapt it to provide you with your custom footer.

1 Like

The Nav Link Header plugin sounds like it’s doing something similar to what I want. I’ll take a look and see if I can figure out how to bend it to my needs. Thanks!

Nav Link Header was beyond my coding abilities to understand, but I looked at other plugins that added a header or footer and stumbled on “Rich Foot”, which puts inlinks and outlinks in a footer in the markdown editor, and used simple Javascript. I hacked away at it a bit and was able to make it do what I wanted. Now I can remove those ugly dataviewjs blocks from my journals, but still see related files for each journal on the screen. Thanks @holroy for nudjing my head in a slightly different direction than it was heading so I could find a great solution!

Didn’t know about that plugin myself. I’m still considering though to develop my first plugin, which would combine the two, and allow for a custom markdown note to be used as either footer or header for other notes.

I’m dreaming of having the possibilities to run simple(?) dataview queries on top and/or bottom of pages without them actually needed to be included on the note itself. Imagine having some navigational header automatically added to the top (like this thread is about), and then in addition having like MOC cleanup queries in the bottom (like queries to look for notes which ought to be part of your MOC but isn’t, or is linked to the MOC, but not linked from the MOC, and so on).

I think a lot of people would find that useful, especially if you had a few examples to use as starters. Good luck, I look forward to seeing the result!