#Fetching assets
Hygraph automatically generates 4 query types for assets. These are:
Asset queries
asset
assets
assetVersion
assetsConnection
These queries work just like regular queries, and can be filtered by their fields.
Here are some sample queries:
asset
assets
assetVersion
assetsConnection
#Generate URLs with file names
To enhance SEO and improve user trust, you can include the original file name in asset URLs generated via the new Hygraph Asset Management system.
- Run the following query:
Query
Response
- Combine the
url
andfileName
manually or via a script, separated by/
. The final URL would look like this:
https://eu-central-1-shared-euc1-02.graphassets.com/cmbq7mmxm0nhp07uqduk/cmcaodlnt9vxpfhycpf4/content-finder.gif
Pro Tip
Ensure that the file name and file extension (jpg
, webp
, etc.) matches the current version of the asset. If you convert a jpg
to webp
using URL transformations, then you need to update the extension at the end to webp
.