How to create a Media Library / Download Section

Hi,

We have to build a "Media Library / Download Sections" for our client on the front end.

Here are some details:

  • Each product or service has some pdfs or word files attached to it
  • Currently, we have an additional tab where the user can add the files and add some details like the title
  • Then, the user has to add a slice for printing out those fields on the product/service page

However, if we want to get all of these files attached to a product or service, we've to query all pages and print them. This way is just unmaintainable for a website with a lot of products.

One option would be to create a custom post type for the files and then create relations. Not sure if there is a better way.

Any ideas? :slight_smile:

Hey @aleksandar.basara1, Yes, using Content Relationship fields would be the best option if you need to know how many documents are using some specific file.

You can add an additional field next to the Media field to help you identify the media item. For example, if you could add a Key Text field, and then in the documents editors must add a unique value per media item, so that then you could query your documents by a FullText search

1 Like

@Paulina Thank you! Yes, we'll do it with an additional post type.

One more question: is it possible to import and map assets via your API?

Hey @aleksandar.basara1

The import feature allows you to import documents and their media files. But I'm not sure if this is what you need.

What would be the use case for importing assets?