Skip to content

Commit 6dc8ed3

Browse files
authored
Images: Fix images not rendering in preview (#403)
1 parent 3fc5194 commit 6dc8ed3

File tree

9 files changed

+25
-17
lines changed

9 files changed

+25
-17
lines changed

exampleSite/content/_index.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
22
title: Example Site for NGINX Hugo Theme
3-
description:
3+
description:
44
---
55

6-
## NGINX Hugo Theme Documentation
6+
## NGINX Hugo Theme Documentation
77
Documentation for hugo theme
88
{{<card-section>}}
99
{{<card title="Test Product" titleUrl="/test-product/" icon="test-tubes" isLanding="true">}}
@@ -12,8 +12,7 @@ Documentation for hugo theme
1212
{{<card title="Test Nested Product" titleUrl="/nested/product" icon="test-tubes" isLanding="true">}}
1313
Test nested product path
1414
{{</card >}}
15-
{{<card title="NGINX Plus" titleUrl="/nginx/" brandIcon="NGINX-Plus-product-icon-RGB.svg" isLanding="true">}}
15+
{{<card title="NGINX Plus" titleUrl="/nginx/" brandIcon="NGINX-Plus-product-icon.svg" isLanding="true">}}
1616
See a live example of theme components
1717
{{</card >}}
1818
{{</card-section>}}
19-

exampleSite/content/nginx/installing-nginx-open-source.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ weight: 200
1010
nd-reading-time: true
1111
---
1212

13-
![hero-graphic](/hero-graphic.webp)
14-
13+
{{<img src="hero-graphic.webp" alt="hero graphic">}}
1514
```nginx
1615
1716
# Global Configuration

layouts/_default/list.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@
1010
{{ end }}
1111
</div>
1212
<div class="list-header-container">
13-
<img src="/images/icons/{{ .Params.logo | default "NGINX-product-icon.svg" }}">
13+
{{ $logo := .Params.logo | default "NGINX-product-icon.svg"}}
14+
{{ with printf "images/icons/%s" $logo }}
15+
<img src="{{. | absURL}}">
16+
{{ end }}
17+
1418
<div class="list-header-title">
1519
<h1>{{ .Title }}</h1>
1620
{{ if index .Params "nd-subtitle" }}

layouts/partials/favicon.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<link rel="shortcut icon" type="image/x-icon" href="{{ "/images/favicon-48x48.ico" | absURL }}">
1+
<link rel="shortcut icon" type="image/x-icon" href="{{ "images/favicon-48x48.ico" | absURL }}">

layouts/partials/footer-v2.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div class="footer-layout">
22
<div class="footer-f5-trademark" data-testid="footer-f5-trademark">
3-
<img class="f5-logo-footer" src="{{ "/images/icons/Logo_F5.svg" | absURL }}" alt="F5 logo">
3+
<img class="f5-logo-footer" src="{{ "images/icons/Logo_F5.svg" | absURL }}" alt="F5 logo">
44
<p>©2025 F5, Inc. All rights reserved. NGINX is a registered trademark of F5, Inc.</p>
55
</div>
66
<div class="footer-useful-links" data-testid="footer-useful-links">

layouts/partials/header.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
<div class="header__logo" data-testid="header__logo">
2626
<a class="header__logo-link" href="{{ .Site.BaseURL | relLangURL }}" alt="NGINX Docs Home">
27-
<img class="header__img" src="{{ "/images/icons/NGINX-Open-Source-product-icon.svg" | absURL }}" alt="NGINX Docs">
27+
<img class="header__img" src="{{ "images/icons/NGINX-Open-Source-product-icon.svg" | absURL }}" alt="NGINX Docs">
2828
</a>
2929
</div>
3030

layouts/partials/lucide.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
{{- /* Usage: */ -}}
22
{{- /* (dict "context" . "icon" "circle") */ -}}
3-
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" aria-hidden="true" class="lucide" style="{{ .style | safeCSS }}"><use href="/images/lucide-sprite.svg#{{ .icon }}"></use></svg>
3+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" aria-hidden="true" class="lucide" style="{{ .style | safeCSS }}">
4+
{{ with printf "images/lucide-sprite.svg#%s" .icon }}
5+
<use href="{{. | absURL}}"></use>
6+
{{ end }}
7+
</svg>

layouts/partials/meta.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@
2424
{{ end }}
2525

2626
<meta property="article:publisher" content="https://www.facebook.com/nginxinc" />
27-
<meta property="og:image" content="{{ "/images/icons/NGINX-Docs-new-docs-dark-1200x630.png" | absURL }}" />
27+
<meta property="og:image" content="{{ "images/icons/NGINX-Docs-new-docs-dark-1200x630.png" | absURL }}" />
2828
<meta property="og:image:width" content="500" />
2929
<meta property="og:image:height" content="300" />
3030
<meta name="twitter:card" content="summary" />
3131
<meta name="twitter:description" content="{{.Page.Description}}" />
3232
<meta name="twitter:title" content="{{.Page.Title}}" />
3333
<meta name="twitter:site" content="@nginx" />
34-
<meta name="twitter:image" content="{{ "/images/icons/NGINX-Docs-new-docs-dark-1200x630.png" | absURL }}" />
34+
<meta name="twitter:image" content="{{ "images/icons/NGINX-Docs-new-docs-dark-1200x630.png" | absURL }}" />
3535
<meta name="twitter:creator" content="@nginx" />
3636
{{ if .Page.Lastmod }}
3737
<meta http-equiv="last-modified" content="{{ .Page.Lastmod.Format "02/01/2006" }}" />
@@ -66,4 +66,4 @@
6666
<!-- Coveo metadata-->
6767
<meta name="product" content="{{ .Site.Title }}">
6868
<meta name="version" content="{{ .Site.Params.currentVersion }}">
69-
<meta name="doc_type" content="Manual">
69+
<meta name="doc_type" content="Manual">

layouts/shortcodes/card.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{- $title := .Get "title" -}}
2-
{{- $titleUrl := .Get "titleUrl" | default "." -}}
2+
{{- $titleUrl := .Get "titleUrl" | default "." -}}
33
{{- $icon := .Get "icon" | default "book-open" -}}
44
{{- $brandIcon := .Get "brandIcon" -}}
55
{{- $isFullSizeParam := .Get "isFullSize" | default "false" -}}
@@ -41,7 +41,9 @@
4141
{{- if $title -}}
4242
<div class="card-header">
4343
{{- if $brandIcon -}}
44-
<img class="card-brand-icon" src="/images/icons/{{ $brandIcon }}">
44+
{{ with printf "images/icons/%s" $brandIcon }}
45+
<img class="card-brand-icon" src="{{. | absURL}}">
46+
{{ end }}
4547
{{- else if $icon -}}
4648
{{ partial "lucide" (dict "context" . "icon" $icon) }}
4749
{{- end -}}
@@ -57,4 +59,4 @@ <h2 class="card-title">{{- $title -}}</h2>
5759
</a>
5860
{{- else -}}
5961
{{ errorf "The '<card>' must be nested directly inside the shortcode '<card-section>'. Please see the exampleSite for an example of usage." }}
60-
{{- end -}}
62+
{{- end -}}

0 commit comments

Comments
 (0)