oleeskild / obsidian-digital-garden

MIT License
1.42k stars 128 forks source link

Tags #91

Closed Calorion closed 1 year ago

Calorion commented 2 years ago

Tags don't seem to propagate to the site. Is that by design? I'd sure love to have tags!

oleeskild commented 2 years ago

Are these tags defined in the frontmatter? i.e. something like

---
dg-publish: true
tags: sometag
---

If so, yes this is by design. All properties not recognized by the plugin are stripped away. This is to prevent the site from crashing if there are some unrecognized properties that the templating engine aren't able to parse.

But I've added an option to let through all frontmatter, not stripping away anything. If you check the "Let all frontmatter through" option in the note settings, the tags should propagate as expected. But be aware that the site might break. If it does, you can disable the global option, and instead add "dg-pass-frontmatter: true" to the notes where you want the tags to propagate.

Let me know if you get it to work or not.

timjore commented 1 year ago

I also would 👍 the addition of tags. Two views would be great: alphabetical list of tags, tag cloud sorted by number of notes with the tag.

oleeskild commented 1 year ago

I think @uroybd 's implementation of tags is very good. If it's okay with him, I would like to add this to the digital garden template. Here is an example: https://topobon.utsob.me/personal/journal/art-and-error/ . Clicking any of the tags brings up the search bar, and will show all other notes with that tag.

Implementing this as something you can toggle on or off in the settings would be great. Any thought on that @timjore @Calorion ?

The two views you are talking about @timjore, could be accomplished today by creating two pages with a dataview query. There is a thread in the forum discussing a "tag"-query here: https://forum.obsidian.md/t/creating-a-tag-index-table-with-dataview/23997/9

uroybd commented 1 year ago

I think @uroybd 's implementation of tags is very good. If it's okay with him, I would like to add this to the digital garden template. Here is an example: https://topobon.utsob.me/personal/journal/art-and-error/ . Clicking any of the tags brings up the search bar, and will show all other notes with that tag.

Implementing this as something you can toggle on or off in the settings would be great. Any thought on that @timjore @Calorion ?

The two views you are talking about @timjore, could be accomplished today by creating two pages with a dataview query. There is a thread in the forum discussing a "tag"-query here: https://forum.obsidian.md/t/creating-a-tag-index-table-with-dataview/23997/9

I will create a PR then.

Calorion commented 1 year ago

Interesting. I was just wanting tapping on a tag to load a page that showed only entries with that tag. I'm not sure whether this is better or worse, though the ability to search for posts tagged with more than one tag is good.

timjore commented 1 year ago

Listing tagged pages via the search bar is at least a partial solution—much better than no tag support.

If each tag gets its own page with links to all notes containing the tag (and tags is a folder in the filetree with each tag under it), it seems the graph view would still work for tags. Tags in the graph and tags in a note would link to the page for that tag. This seems like an effective way to handle tags, though I'm not sure how much processing would be needed on the backend by 11ty.

uroybd commented 1 year ago

Let's start, at least as in my site, shall we? I'll create the PRs then.

oleeskild commented 1 year ago

Yes, let's start there. And then we can look a bit more into what you envisioned @Calorion and @timjore

oleeskild commented 1 year ago

Support for tags as discussed here has been released. I've also added support for inline tags. That is tags that are not in the frontmatter, but part of the note itself. This will now render as a tag instead of plain text. Clicking on it will search for that tag, both for inline tags and for frontmatter tags.

timjore commented 1 year ago

@oleeskild what is the process for making this update work on a site that is already deployed? I have merged all the PRs and updated the plugin.

oleeskild commented 1 year ago

By looking at your PRs I think you've only merged PRs added by dependabot, which is a bot made by github that automatically updates libraries that has newer versions available.

To get the latest template changes, you need to use the "update template" option in the plugin settings. It's explained here: https://dg-docs.ole.dev/getting-started/06-updating-the-template/

Let me know if you get it to work or not.

timjore commented 1 year ago

That works, thanks. I note that it works well for some tags, but not at all for some... I have 3 notes tagged #cognition but when I click the tag it shows "No results for #cognition" (same for the #strategic tag). All my tags are inline (not frontmatter).

oleeskild commented 1 year ago

Hmm, weird. I will look into it!

oleeskild commented 1 year ago

@timjore I think the issue is that you don't have the latest version of the template. Try updating the template and see if it works then.

oleeskild commented 1 year ago

@timjore @Calorion I'm closing this issue as tags are now supported. If there are some other features you would like to see, related to tags, please create a new issue describing it 😄