What is the difference between an Obsidian metadata tag : vs tag ::?

What I’m trying to do

Find a definition of the difference between tag : and tag :: in Obsidian metadata

Things I have tried

tag :, tag ::, tags in metadata, tags in YAML, tags in frontmatter

You use the single colon variant in the frontmatter/YAML, and the double colon variant outside of the frontmatter. The latter is called inline fields.

There are syntax differences between the two variants, but dataview will use either variant when properly defined. Various other plugins could use both, but most of them (if they deal with fields at all) will mainly focus/understand the frontmatter variant.

Update: I understood your usage of tag as a generic field name. And not stuff like #tag

1 Like

The single-colon frontmatter version is a core feature and is formatted in YAML which is a preexisting language and supported by other apps (which don’t necessarily all support a “tags” field). The inline version is specific to the DataView community plugin and isn’t supported outside of Obsidian as far as I know.

2 Likes

Actually, you don’t use the double colon outside the frontmatter to define tags. The syntax is #tagname

The double colon in the body is typically used to define a field for the Dataview plugin. For example tag:: tagname would define a Dataview field called tag with a value tagname but would not create an Obsidian tag.

2 Likes

This is true but when using multiple in-line fields in a note I still put tags:: #tagname for visual consistency with other fields even though it doesn’t add functionality.

1 Like

Do note that by using tags:: #some, #tags you’re messing with what’s accessible from dataview somewhat, since you’re defining an inline field which doesn’t hold all the actual tags associated with the file.

Try adding the following to a file:

---
Tags: f60610, frontmatter
---
#nested/body/tag 

tags:: #tags

this.file.tags:  `= this.file.tags `
this.file.etags: `= this.file.etags `
this.tags: `= this.tags`

Which in my case displays as:

So I’d say that you’re kind of playing with fire, when doing a tags:: * in your notes.

3 Likes

@holroy Just to check, is the issue here that we are using a tag as a value for an inline field, or that we are as using an inline field named “tags” that is misleading in that it does not reference all tags?

I use the following convention, for e.g., in my “project definition” file to identify the global tag associated with it:

[project-tag:: #project/43]

This would be OK from a data model perspective?

All of the following are just strange:

#someTag:: 5
Tags:: WhoDidThis
[[SomeNote]]:: someValue

I would not recommend either of these.

The example of [project-tag:: #project/42], I don’t see any issue with.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.