Skip to content

Commit 27ebc94

Browse files
committed
Add href property to image
1 parent 1560a57 commit 27ebc94

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

_includes/image.html

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
{% assign src = include.src | default:"" %}
22
{% assign alt = include.alt | default:"" %}
33
{% assign max_width = include.max_width | default:"" %}
4+
{% assign href = include.href | default:"" %}
45

56
{% if src != "" %}
6-
<img src="{{ src }}"
7-
alt="{{ alt }}"
8-
class="img-fluid mx-auto d-block"
9-
{% if max_width != "" %}style="max-width: {{ max_width }}; width: 100%;"{% endif %}>
7+
{% if href != "" %}
8+
<a href="{{ href }}"
9+
class="mx-auto d-block"
10+
{% if max_width != "" %}style="max-width: {{ max_width }}; width: 100%;"{% endif %}>
11+
<img src="{{ src }}" alt="{{ alt }}" class="img-fluid">
12+
</a>
1013
{% else %}
11-
<p class="error">Error: Missing 'src' attribute in include 'image.html'.</p>
14+
<img src="{{ src }}"
15+
alt="{{ alt }}"
16+
class="img-fluid mx-auto d-block"
17+
{% if max_width != "" %}style="max-width: {{ max_width }}; width: 100%;"{% endif %}>
18+
{% endif %}
19+
{% else %}
20+
<p class="error">Error: Missing 'src' attribute in include 'image.html'.</p>
1221
{% endif %}

0 commit comments

Comments
 (0)