mjsumpter / obsidian-tag-page

An Obsidian plugin to create and manage dedicated Markdown pages for tags, with features to automatically populate and refresh content based on user-defined settings.
MIT License
18 stars 3 forks source link

[Bug] Mixing frontmatter tags and content tags excludes one of the categories #16

Closed ngraham20 closed 5 months ago

ngraham20 commented 6 months ago

I have some notes with the tag in the metadata and others with the same tag in the content. When I do this, it appears that whichever group is smaller will not get generated. If there are more content tags, the frontmatter ones aren't generated, and if there are more frontmatter ones, then the content one isn't generated. The header for the Content tags is still there, but it's not populated.

Here's some example pages that I have:

# daily-note_Tags
---
tag-page-query: "#daily-note"
---
## Tag Content for #daily-note
## Files with #daily-note in frontmatter
- [[Daily]]
- [[2024-03-15]]
- [[2024-03-14]]
- [[2024-02-29]]
- [[2024-02-25]]
# Testpage
#daily-note
# 2024-03-15
---
tags:
- daily-note
---
mjsumpter commented 6 months ago

Hi @ngraham20 , thanks for submitting this!

I'll try to get on this asap - a few questions for clarification:

ngraham20 commented 6 months ago

Hi @mjsumpter! I love that you responded to this so quickly! It's the other way around. Essentially, the tags inside

---
tags:
- daily-note
---

I would expect to show up in the Frontmatter section, and everything else to show up in Tag Content. If you make a tag page with only one or the other, you'll see the header change saying where the tag was gleaned from, but if you put a single tag on two pages, where one page has the tag specified in the metadata and the other has it within the actual note text body, then only one of the tags will actually wind up on the tag page.

Here is what I would have expected. In this output, Testpage is present, whereas in my example before, it was omitted.

# daily-note_Tags
---
tag-page-query: "#daily-note"
---
## Tag Content for #daily-note
- **daily-note** [[Testpage|*]]
## Files with #daily-note in frontmatter
- [[Daily]]
- [[2024-03-15]]
- [[2024-03-14]]
- [[2024-02-29]]
- [[2024-02-25]]

The actual organization of how the two types of tags would be grouped isn't important to me, only that they all show up

mjsumpter commented 6 months ago

I'm either misunderstanding, or this is a specific edge case (which is worth addressing), but I just want to be sure we are on the same page about the problem. Here are three pages I created:

"TestPage1":

#daily-note with some other content.

Here is a new paragraph.

"TestPage2":

---
tags:
- daily-note
---

and "TestPage3 both":

---
tags:
- daily-note
---
#daily-note but both with front-matter and other content

Here is a new paragraph for both

This is what the resulting tag page looks like:

---
tag-page-query: "#daily-note"
---
## Tag Content for #daily-note
- **daily-note** but both with front-matter and other content [[TestPage3 both|*]]
- **daily-note** with some other content. [[TestPage1|*]]
## Files with #daily-note in frontmatter
- [[TestPage3 both]]
- [[TestPage2]]

From my understanding of your problem, your test page:

# Testpage
#daily-note

Doesn't have any content closely associated with the tag itself. The plugin currently is "opinionated", in the sense it has the following behavior:

The important point (I think) is the second one. In your example test page #daily-note is a unit all by itself, separated by newlines. As such, the content isn't captured by the plugin intentionally.

Am I understanding the problem correctly? If I am, and you still would like this to change, can you describe to me your use-case for wanting to have a tag work standalone on a line like this?

ngraham20 commented 6 months ago

The specific issue I'm running into is that I have primarily written my tags at the top of my page but not in the frontmatter. These tags also do not have any content after them (essentially doing the same thing as the frontmatter but not in the metadata section itself). What I'm finding is that I have a specific tag that is aggregating all of my pages except a few.

The ones that are being correctly collected are all in the format

# Page title
#tag/subtag
#anothertag
#a-third-tag

but a specific subset of my pages I have the tags in the format

---
tags:
- tag/subtag
- anothertag
- a-third-tag
---

and for some reason, these specific pages are being left out of the aggregation.

ngraham20 commented 6 months ago

I did find however, that the reverse case was a slightly different bug than I thought. If I have an empty note with only the tag, i.e.

notice the lack of newline after the tag


# Page title
#tag```

then that particular page is also not added to the list.
mjsumpter commented 6 months ago

Okay I gotchya 🤙 . Will get to work on this

mjsumpter commented 6 months ago

Hey @ngraham20 , I just released an update (v1.0.1) that I think may have unintentionally fixed this. Can you let me know if you are still seeing issues?

ngraham20 commented 5 months ago

hey yeah, that worked! Thanks a bunch @mjsumpter!