The collection/asset filter can be used not only for finding the content you need. It can also help you configure your home page.
Let’s have a closer look at the function Get Code on the filter panel. You can find it in the bottom right corner of the panel. By clicking on it, you generate a code which can be used as a reference to the selected set of assets/collections. The code is generated in the JSON format and can be used for applying certain rules or performing certain actions to a selected set of assets or collections.
Here are some examples of what the code can be used for:
- To configure access rights to assets
- To customise the main page of your workspace
The algorithm for customising the main page using the option Get Code works through these three main stages
- The selection of collections intended to be displayed on the main page is made by using the filter by collections
- A code is generated by using the Get Code function and then copied to the clipboard. Since the code is generated in the JSON format, it is compatible with the admin panel and can be used for customising the main page
- The code is inserted into the appropriate field of the admin panel
Now find our step-by-step guide on how to work with the Get Code function from the filter panel, together with some practical tips on how to use the filter for creating collection blocks to make the main page of your workspace unique.
How to get the code to selected collections:
- Go to the Collections page by clicking on the button Collections on the top bar.
Attention! For the code to work properly, filtering must be done by collections, not by assets.
- Click on the filter button and type in your search request. Here is an example where filtering is done by tag and Public property.
It is important to know that each type of main page block uses the filter in a different way:
- for types 1 and 2, the default main collection which is displayed on the main page, is the collection appearing first in the filtering results. Refer to the filtering results to see which collection will be shown on your main page.
- for type 3, all collections found by the same filter are displayed on the main page in exactly the same order in which they appear in the filtering results.
- Click on Apply and view found collections to make sure that they are all relevant to your search.
- Press again , and the button Get a code. A unique code will be generated and saved to the clipboard for later use.
- Now open the admin panel, find the block card and paste this code into the Query
- Then follow steps 4 and 5 from here: Managing the main page
The use of properties for different types of blocks:
- Types 1 and 2: if you want to display a specific collection on your home page, the easiest way to do this is to filter collections by name, as shown in the example above. This will allow you to select the exact collection you need. For example, you have found a few collections sharing a property in their descriptions. It may happen that at some point another collection with the same property will be added to the library. It might get higher in the search results and thus will appear on the homepage.
- Type 3: the best way here is to filter by an existing tag, or create a special tag for a particular block. First, add the tag to the collections you wish to have in your selection, then filter collections using this tag.