Skip to content

Commit ac789a8

Browse files
docs(getting-started): add guide for customizing base URLs
Add a new documentation page explaining how to override the default developer hub and assets base URLs in Clever Cloud components. Includes usage examples for `setDevHubBaseUrl` and `setAssetsBaseUrl`, and highlights the importance of configuring URLs before importing components.
1 parent 0d31589 commit ac789a8

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
---
2+
kind: '🚀 Getting started'
3+
title: 'Customizing base URLs'
4+
---
5+
6+
# Customizing base URLs
7+
8+
By default, Clever Cloud components generate URLs that point to:
9+
* `https://www.clever.cloud/developers` for documentation and developer hub links
10+
* `https://assets.clever-cloud.com` for static assets
11+
12+
You can override these base URLs.
13+
14+
## Customizing the developer hub base URL
15+
16+
Use `setDevHubBaseUrl()` to change the base URL for documentation and developer hub links.
17+
18+
```js
19+
import { setDevHubBaseUrl } from '@clevercloud/components/dist/dev-hub-url.js';
20+
21+
// Set a custom base URL
22+
setDevHubBaseUrl('https://staging.clever-cloud.com/developers');
23+
24+
// Now import components
25+
import '@clevercloud/components/dist/cc-addon-info.js';
26+
```
27+
28+
After this configuration, all documentation links generated by components will use your custom base URL:
29+
30+
* `getDocUrl('/addons/postgresql')``https://staging.clever-cloud.com/developers/doc/addons/postgresql`
31+
* `getDevHubUrl('/api/v4')``https://staging.clever-cloud.com/developers/api/v4`
32+
33+
## Customizing the assets base URL
34+
35+
Use `setAssetsBaseUrl()` to change the base URL for static assets like logos, flags, and icons.
36+
37+
```js
38+
import { setAssetsBaseUrl } from '@clevercloud/components/dist/assets-url.js';
39+
40+
// Set a custom assets URL
41+
setAssetsBaseUrl('https://cdn.example.com');
42+
43+
// Now import components
44+
import '@clevercloud/components/dist/cc-addon-info.js';
45+
```
46+
47+
After this configuration, all asset URLs generated by components will use your custom base URL:
48+
49+
* `getAssetUrl('/logos/java-jar.svg')``https://cdn.example.com/logos/java-jar.svg`
50+
* `getFlagUrl('fr')``https://cdn.example.com/flags/fr.svg`
51+
52+
## Important: call before importing components
53+
54+
You **must** call `setDevHubBaseUrl()` and `setAssetsBaseUrl()` **before** importing any components. Otherwise, some URLs may still use the default base URLs.
55+
56+
```js
57+
import { setDevHubBaseUrl } from '@clevercloud/components/dist/dev-hub-url.js';
58+
import { setAssetsBaseUrl } from '@clevercloud/components/dist/assets-url.js';
59+
60+
// Configure base URLs first
61+
setDevHubBaseUrl('https://staging.clever-cloud.com/developers');
62+
setAssetsBaseUrl('https://cdn.example.com');
63+
64+
// Then import components
65+
import '@clevercloud/components/dist/cc-addon-info.js';
66+
import '@clevercloud/components/dist/cc-invoice-list.js';
67+
```
68+

0 commit comments

Comments
 (0)