Image gallery using a list of links in a frontmatter property

What I’m trying to do

Hi everyone, I’m new around here and not very fluent in dataview/js. What I’m trying to do is basically an image gallery inside a note, but using a list of links in a frontmatter property.

What I’d like to accomplish is:

  • add a frontmatter property called “gallery” which will contain a list of external image links (I don’t actually know which format I would need tho, if the external link type with square bracket and link, wikilinks or the simple string with the link)
  • somehow use that property inside the codeblock of masonry grids

Alternatively:

  • add a frontmatter property called “gallery” which will contain a link to an internal note
  • the note will contain only a list of links as specified before for the frontmatter
  • somehow use that property to retrieve the links and put them inside the codeblock of masonry grids

Also, it seems that metadata menu plugin doesn’t actually have a data type for external image links, or am I missing something? In case it doesn’t, is there anyone knowing if there is a feature request for that or a better plugin that does better than metadata menu?

Things I have tried

A few of the solutions for slightly different problems i found in the forum but changing them as I thought it would be right. (spoiler: I didn’t achieve quite what I wanted)

Here is the one that got me the closest, but I can’t arrange the images in a style like the one with the grids I mentioned before and writing a specific css just for that is not something I’d like to do since I’m no expert at that.

Any help is much appreciated, thank you!

EDIT:
Another thig I actually tried is (obviously not knowing what else to do ahah) using chatGPT and it returned me this bit of code

let imageLinks = [
    "https://example.com/image1.jpg",
    "https://example.com/image2.png",
    "https://example.com/image3.gif"
]

dv.el('pre', imageLinks.map(link => `![](${link})`).join("\n"))

which actually returned a list of images when inserting the proper strings in the place of the dummy links, but again not in the layout I wanted.

Also tried this with little to no results.

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