Skip to content

Commit 9bcbf8a

Browse files
fix: correct icon file path format to use relative paths
- Change from file: prefix to relative paths (./assets/icons/...) - Update navbar-links icon examples to use ./assets/icons/ - Update sidebar icons examples to use relative paths - Update product icons examples to use relative paths - Add note that paths are relative to the YAML file where declared - Wrap inline SVG examples in quotes for proper YAML parsing Co-Authored-By: Catherine Deskur <[email protected]>
1 parent 232a2ba commit 9bcbf8a

File tree

3 files changed

+24
-22
lines changed

3 files changed

+24
-22
lines changed

fern/products/docs/pages/customization/what-is-docs-yml.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ navbar-links:
241241
text: Login
242242
href: https://example.com/login
243243
rounded: false
244-
icon: file:assets/icons/login-icon.svg
244+
icon: ./assets/icons/login-icon.svg
245245
- type: github
246246
value: https://github.com/example-company/fern
247247
```
@@ -270,16 +270,16 @@ navbar-links:
270270
The icon to be used in the button. This icon will appear to the **left** of the text content. Supports three formats:
271271

272272
- **Font Awesome icons**: Use icon names like `fa-solid fa-rocket`. Pro and Brand Icons from Font Awesome are supported.
273-
- **Custom image files**: Use `file:` prefix followed by the file ID (e.g., `file:my-icon`). The file must be uploaded to your docs assets.
274-
- **Inline SVG**: Provide an SVG string wrapped in `< >` (e.g., `<svg>...</svg>`).
273+
- **Custom image files**: Use relative paths to image files (e.g., `./assets/icons/my-icon.svg` or `../assets/icons/my-icon.png`). Paths are relative to the `docs.yml` file.
274+
- **Inline SVG**: Provide an SVG string wrapped in quotes (e.g., `"<svg>...</svg>"`).
275275
</ParamField>
276276

277277
<ParamField path="rightIcon" type="string" required={false} toc={true}>
278278
The icon to be used in the button. This icon will appear to the **right** of the text content. Supports three formats:
279279

280280
- **Font Awesome icons**: Use icon names like `fa-solid fa-arrow-right`. Pro and Brand Icons from Font Awesome are supported.
281-
- **Custom image files**: Use `file:` prefix followed by the file ID (e.g., `file:my-icon`). The file must be uploaded to your docs assets.
282-
- **Inline SVG**: Provide an SVG string wrapped in `< >` (e.g., `<svg>...</svg>`).
281+
- **Custom image files**: Use relative paths to image files (e.g., `./assets/icons/my-icon.svg` or `../assets/icons/my-icon.png`). Paths are relative to the `docs.yml` file.
282+
- **Inline SVG**: Provide an SVG string wrapped in quotes (e.g., `"<svg>...</svg>"`).
283283

284284
By default, the `rightIcon` for a `filled` button is set to `arrow-right`.
285285
</ParamField>

fern/products/docs/pages/navigation/overview.mdx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,8 @@ navigation:
202202
Add icons next to sections and pages using the `icon` key. Icons support three formats:
203203

204204
- **Font Awesome icons**: Use icon names like `fa-regular fa-home`. Pro and Brand Icons from Font Awesome are supported.
205-
- **Custom image files**: Use `file:` prefix followed by the file ID (e.g., `file:my-icon`). The file must be uploaded to your docs assets.
206-
- **Inline SVG**: Provide an SVG string wrapped in `< >` (e.g., `<svg>...</svg>`).
205+
- **Custom image files**: Use relative paths to image files (e.g., `./assets/icons/my-icon.svg` or `../assets/icons/my-icon.png`). Paths are relative to the YAML file where the icon is declared.
206+
- **Inline SVG**: Provide an SVG string wrapped in quotes (e.g., `"<svg>...</svg>"`).
207207

208208
### Font Awesome icons
209209

@@ -223,32 +223,32 @@ navigation:
223223

224224
### Custom image files
225225

226-
To use custom image files as icons, upload your image files to your docs assets folder, then reference them using the `file:` prefix followed by the relative path to the file.
226+
To use custom image files as icons, upload your image files to your docs assets folder, then reference them using relative paths. Paths are resolved relative to the YAML file where the icon is declared.
227227

228228
{/* <!-- vale off --> */}
229229
```yaml Example navigation config with custom image icons
230230
navigation:
231231
- section: Products
232-
icon: file:assets/icons/products-icon.svg
232+
icon: ./assets/icons/products-icon.svg
233233
contents:
234234
- page: Product A
235-
icon: file:assets/icons/product-a.png
235+
icon: ./assets/icons/product-a.png
236236
path: ./pages/product-a.mdx
237237
- page: Product B
238-
icon: file:assets/icons/product-b.png
238+
icon: ./assets/icons/product-b.png
239239
path: ./pages/product-b.mdx
240240
```
241241
{/* <!-- vale on --> */}
242242

243243
### Inline SVG icons
244244

245-
You can also provide inline SVG strings directly in your configuration by wrapping them in `< >`.
245+
You can also provide inline SVG strings directly in your configuration. Wrap the SVG in quotes to ensure proper YAML parsing.
246246

247247
{/* <!-- vale off --> */}
248248
```yaml Example navigation config with inline SVG icons
249249
navigation:
250250
- section: Custom Section
251-
icon: <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M12 2L2 7v10c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V7l-10-5z"/></svg>
251+
icon: "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'><path d='M12 2L2 7v10c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V7l-10-5z'/></svg>"
252252
contents:
253253
- page: Custom Page
254254
path: ./pages/custom-page.mdx
@@ -280,8 +280,8 @@ navigation:
280280
Within the navigation, you can add `tabs`. Tabs are used to group sections together. The example below shows tabs for `Help Center`, `API Reference`, and an external link to `Github`. Each tab has a `title` and `icon`. Icons support three formats:
281281

282282
- **Font Awesome icons**: Use icon names like `puzzle` or `fa-solid fa-puzzle`. [Browse the icons available](https://fontawesome.com/icons) from Font Awesome. Pro and Brand Icons are supported.
283-
- **Custom image files**: Use `file:` prefix followed by the file ID (e.g., `file:my-icon`). The file must be uploaded to your docs assets.
284-
- **Inline SVG**: Provide an SVG string wrapped in `< >` (e.g., `<svg>...</svg>`).
283+
- **Custom image files**: Use relative paths to image files (e.g., `./assets/icons/my-icon.svg` or `../assets/icons/my-icon.png`). Paths are relative to the YAML file where the icon is declared.
284+
- **Inline SVG**: Provide an SVG string wrapped in quotes (e.g., `"<svg>...</svg>"`).
285285

286286
<CodeBlock title="docs.yml">
287287
{/* <!-- vale off --> */}

fern/products/docs/pages/navigation/products.mdx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ The optional parameters are: `image`, `icon`, `subtitle`, `slug`, and `versions`
9999
Product icons support three formats:
100100

101101
- **Font Awesome icons**: Use icon names like `fa-solid fa-leaf`. Pro and Brand Icons from Font Awesome are supported.
102-
- **Custom image files**: Use `file:` prefix followed by the relative path to the file (e.g., `file:assets/icons/my-icon.svg`). The file must be in your docs assets folder.
103-
- **Inline SVG**: Provide an SVG string wrapped in `< >` (e.g., `<svg>...</svg>`).
102+
- **Custom image files**: Use relative paths to image files (e.g., `./assets/icons/my-icon.svg` or `../assets/icons/my-icon.png`). Paths are relative to the `docs.yml` file.
103+
- **Inline SVG**: Provide an SVG string wrapped in quotes (e.g., `"<svg>...</svg>"`).
104104

105105
#### Font Awesome icons
106106

@@ -117,32 +117,34 @@ products:
117117

118118
#### Custom image files
119119

120-
To use custom image files as product icons, upload your image files to your docs assets folder, then reference them using the `file:` prefix followed by the relative path.
120+
To use custom image files as product icons, upload your image files to your docs assets folder, then reference them using relative paths. Paths are resolved relative to the `docs.yml` file.
121121

122122
<CodeBlock title="docs.yml">
123123
```yaml
124124
products:
125125
- display-name: Product A
126126
path: ./products/product-a.yml
127-
icon: file:assets/icons/product-a-icon.svg
127+
icon: ./assets/icons/product-a-icon.svg
128128
slug: product-a
129129
subtitle: Product A subtitle
130130
- display-name: Product B
131131
path: ./products/product-b.yml
132-
icon: file:assets/icons/product-b-icon.png
132+
icon: ./assets/icons/product-b-icon.png
133133
slug: product-b
134134
subtitle: Product B subtitle
135135
```
136136
</CodeBlock>
137137

138138
#### Inline SVG icons
139139

140+
Wrap the SVG in quotes to ensure proper YAML parsing.
141+
140142
<CodeBlock title="docs.yml">
141143
```yaml
142144
products:
143145
- display-name: Product A
144146
path: ./products/product-a.yml
145-
icon: <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M12 2L2 7v10c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V7l-10-5z"/></svg>
147+
icon: "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'><path d='M12 2L2 7v10c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V7l-10-5z'/></svg>"
146148
slug: product-a
147149
subtitle: Product A subtitle
148150
```
@@ -359,4 +361,4 @@ The dropdown menus for product and version selectors can be customized using the
359361
<img src="webflow-version-selector.avif" alt="Example of a styled version selector" />
360362
</Frame>
361363
</Tab>
362-
</Tabs>
364+
</Tabs>

0 commit comments

Comments
 (0)