DPDK Architecture  ->  Library (v3.4.4)

useAsset

useAsset is a core functionality automatically makes assets from the CMS available to the front-end.

Usage

The asset module exports different functions of which only one has to be used: useGlossary. The other functions are for internal use by the architecture and will not be documented.

Basic usage

Our websites run on many environments that might also change their URLs at some point, so for that reason we decided to dynamically add an environment url to our assets.

Let's say you get a dpdk-architecture.pdf from the API and want to link to it, you simply do:

// assetUrl in config for example: https://dpdk.com
const documentPath = '/cms/assets/dpdk-architecture.pdf'
useAsset(documentPath); // https://dpdk.com/cms/assets/dpdk-architecture.pdf

The environment URL will be set in the core and comes from configuration, see this page for more information.

Last modifiedWednesday, February 3, 2021, 10:17:16 AM UTC
Last authorColin van Eenige
Commit IDa5fc248