Get frontmatter from a different note and list it in another

Things I have tried

I am do not know javascript I have taken someone else’s and attempted to use the docs to get what I need.

const frontmatter = Object.entries("path/to/").file.frontmatter).map((obj) => {
obj[0] = obj[0][0].toUpperCase() + obj[0].substr(1)
return obj
}).filter(obj => obj[0] != "Tags")
dv.table(frontmatter.keys(), frontmatter)

That’s inside backticks with dataviewjs written on the first set. The note the above appears in is in the same folder as (so the ‘to’ of the path given above)

What I’m trying to do

I am trying to get the metadata (frontmatter) from a note in the same folder and list it out in a separate note.
If I use .current() instead of pages() it works perfectly but for the note I am in rather than the different one.

As they’re in the same folder I don’t need path, “” should’ve worked. The reason it didn’t the first time I tried it was because I didn’t get the spacing right in the actual file name.

I’m not sure why you’re using that convoluted syntax stuff in your query, doesn’t this do the same:

const fm = Object.entries(await"note").file.frontmatter)
  .filter(obj => obj[0] != "Tags" )
dv.table(["Field", "Value"], fm)

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