Skip to content

Commit 65acc3d

Browse files
committed
fix: add conditional check for bundledCode in template
Only render bundled code section if bundledCode field exists. This prevents empty code blocks from rendering when bundled versions aren't available.
1 parent 4378da2 commit 65acc3d

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{% if page.data.dependsOn.size != 0 %}
2+
<h2>Depends on</h2>
3+
<ul>
4+
{% for item in page.data._extendedDependsOn %}
5+
<li><a href="{{ item.path | absolute_url }}">{{ item.icon }} {{ item.title }}
6+
{% if item.title != item.path %}<small>({{ item.path }})</small>{% endif %}
7+
</a></li>
8+
{% endfor %}
9+
</ul>
10+
{% endif %}
11+
12+
13+
{% if page.data.requiredBy.size != 0 %}
14+
<h2>Required by</h2>
15+
<ul>
16+
{% for item in page.data._extendedRequiredBy %}
17+
<li><a href="{{ item.path | absolute_url }}">{{ item.icon }} {{ item.title }}
18+
{% if item.title != item.path %}<small>({{ item.path }})</small>{% endif %}
19+
</a></li>
20+
{% endfor %}
21+
</ul>
22+
{% endif %}
23+
24+
25+
{% if page.data.verifiedWith.size != 0 %}
26+
<h2>Verified with</h2>
27+
<ul>
28+
{% for item in page.data._extendedVerifiedWith %}
29+
<li><a href="{{ item.path | absolute_url }}">{{ item.icon }} {{ item.title }}
30+
{% if item.title != item.path %}<small>({{ item.path }})</small>{% endif %}
31+
</a></li>
32+
{% endfor %}
33+
</ul>
34+
{% endif %}
35+
36+
37+
<h2>Code</h2>
38+
39+
<script defer type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
40+
<script defer src="https://cdn.jsdelivr.net/npm/jquery-balloon-js@1.1.2/jquery.balloon.min.js" integrity="sha256-ZEYs9VrgAeNuPvs15E39OsyOJaIkXEEt10fzxJ20+2I=" crossorigin="anonymous"></script>
41+
<script defer type="text/javascript" src="{{ "/assets/js/copy-button.js" | absolute_url }}"></script>
42+
<link rel="stylesheet" href="{{ "/assets/css/copy-button.css" | absolute_url }}">
43+
44+
<span><a id="unbundled"></a></span>
45+
{% include highlight.html extension=page.data._pathExtension content=page.data.code %}
46+
47+
{% if page.data.bundledCode %}
48+
<span><a id="bundled"></a></span>
49+
{% include highlight.html extension=page.data._pathExtension content=page.data.bundledCode %}
50+
{% endif %}
51+
52+
{% if page.data.minifiedCode %}
53+
<span><a id="minified"></a>Minified (Source)</span>
54+
{% include highlight.html extension=page.data._pathExtension content=page.data.minifiedCode %}
55+
{% endif %}
56+
57+
{% if page.data.minifiedBundledCode %}
58+
<span><a id="minified-bundled"></a>Minified (Bundled)</span>
59+
{% include highlight.html extension=page.data._pathExtension content=page.data.minifiedBundledCode %}
60+
{% endif %}

0 commit comments

Comments
 (0)