What I’m trying to do
I want to embed an internal image in a dataview table. The image will sit in a frontmatter property. I want to input [[image.jpg]] as the property (as opposed to ![[image.jpg]]), so it remains dynamic regardless of name or location changes.
e.g.
---
cover: [[image.jpg]]
---
will show the image in a dataview table.
Following the documentation, I found you can use the meta function like so
dataview
TABLE embed(link(meta(cover).path))
WHERE file.name = this.file.name
and this has the desired effect, but I have other fields in the table that can only be achieved using dataviewJS. So I want to translate this result into dataviewJS.
Things I have tried
dataviewjs
dv.table(["Cover"],
dv.pages()
.filter(p =>
p.file.name === dv.current().file.name)
.map(p => [
embed(link(meta(cover).path))
])
)
Obviously doesn’t work as embed, link and meta aren’t defined.
Prior to this, because I had successfully been able to get the following to work for external images (i.e. those of type https://website.com/image.jpg)
.map(p => [
``
])
so I was trying to map
.map(p => [ `!${p.cover}` ])
or
.map(p => [ `![[${p.cover}]]` ])
or
.map(p => [ `![[${String(p.cover)}]]` ])
and several other variations, but these only return text.
I assume the best way would be to find the file path of internal image using dataviewJS, because that’s the method for base dataview. But I’m not bothered about the method, as long as it can convert properties of format property: [[image.jpg]]
into an embedded image. Thanks for you help!