Asset List or JavaScript- Listing files from a Folder with Metadata


(Sean) #1

Hello,

I am trying to use an asset listing to get files from a folder and then display it on the page along with the metadata applied to the files themselves.

I have little to no experience with listing assets dynamically. I do need to list the files to the page in a neat table though.

I have been trying to follow the Dynamic Asset Listing Using Keywords tutorial, but it does not go into getting the metadata for the individual files and listing them.

If there is a way to get the files from the folder using javascript and also getting the metadata at the same time, I would much prefer that, as this is driving me up a wall.

Any help would be greatly appreciated! :slight_smile:

Thanks!


(Tbaatar) #2

This should be relatively easy.

If you can give example setup / structure.


(Sean) #3

Thanks for the reply.

The setup is as follows (in simple terms);

  • Website (Main website)
  • Resources (Holds all relevant resources)

The website is obviously in its own site directory and our resources (PDF, Images, Documents) are in their own resources site directory.

So the asset list is currently placed in the website section, and is trying to grab the documents from the resources section.

Hopefully that makes sense… Just can’t get me head around it to also grab the metadata to create a nice looking table.

Thanks!


(Tbaatar) #4

Hi Sean,

The files/assets under the resources does it have Metadata applied to it? and do any of these files have any tagging, notice or relation to the main pages?

Depending on if it has relation or not, you could try the following:

1/ If the page is is not tagged in anyway you could use the search page and use keywords from the current viewed page to display files from the resources. This is not ideal

2/ If the files in the resource is tagged with the assetid or keyword of the related main pages you could use Asset Listing to display it.

3/ You can create notice links for each files and on the main page you can list the notice links (easiest and most accurate)

4/ From the main pages you can apply metadata and use the related asset input field to assign the related files and use asset listing / ssjs to print these.