Views counter

I would like to have built-in views counter for individuals notes: how many times a note has been viewed. Similar to the view counter of each thread in this forum.

A workaround is to manually increase a variable named e.g. view_counter in the YAML front matter, however it would be nicer if Obsidian supports this out of the box.

4 Likes

I really like the frontmatter idea as a plugin. And it may be straightforward enough for me to tinker with as a first plugin (and a good sandbox as I’d like to build some more things involving editing frontmatter). I’ll let you know if I come up with anything.

(Don’t let this stop other developers. If you have interest in working on this, assume I’m not. I make no guarantees as to the time I’ll be able to put forward on this :slight_smile: )

1 Like

it would also be great if you consider support for the variable rating in YAML front matter as well :grinning:

I’ve opened an issue on the Buttons plugin github to add YAML increment/decrement as a button action. It’s likely that automatic triggering of these button actions is outside the scope of that plugin, but if the YAML integration is implemented, it would at least give the option to click a button when you load a note to add to the counter.

There are sooo many features that could benefit from/would depend on robust CRUD control of frontmatter. I wonder if a single frontmatter-CRUD plugin would be helpful as a sort of frontmatter API that other plugins could take advantage of. I suppose ideally this would be implemented in the official Obsidian plugin API.

Just thinking out loud :slight_smile:

As for rating, I saw somewhere (can’t find it now) the idea of using tags to rate a note, e.g.: #★, #★★, #★★★. And I see your discussion here about ratings. What are you looking for in a YAML rating variable setup?

I’d like to use rating as a way to record the usefulness of the notes to me. For example, I was looking for some info and found it in a note that helped me to refresh the info very efficiently. Then I would increase the rating for that note. Similar to rating at online shops, but only for myself.

Another way to do that could be something like facebook “likes”: how many times I read and found a note useful. Combined with the views_counter this could be more helpful than rating.

It does seem like Buttons would be a great option for this use case; if not now, then perhaps eventually. The developer pointed me to the MetaEdit plugin, also, which could be used independently or perhaps as the action that is triggered by Buttons.

I haven’t given this workflow a try yet, though, so it’s possible it’s not as seamless as one would like, or at this stage faster than manually editing the frontmatter.

I was able to get a counter working with Templater plugin (and a bunch of 1st time badly written JS) and Buttons plugin but it does not refresh the preview page when clicked. You have to toggle back to edit to see that it was changed and then back to preview to see it in preview mode. Probably my lack of skill with the API and JS. Now if you are already in edit mode, using a hotkey against the Templater script works nicely. If you want me to share it (and forgive me for my JS skills) I’d be happy to.