Skip to content

Commit e58455f

Browse files
committed
check if assets is defined
1 parent df70429 commit e58455f

File tree

1 file changed

+4
-0
lines changed
  • src/ansys_sphinx_theme/theme/ansys_sphinx_theme

1 file changed

+4
-0
lines changed

src/ansys_sphinx_theme/theme/ansys_sphinx_theme/layout.html

+4
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@
77
<!-- Include desired assets -->
88
<script src="https://code.jquery.com/jquery-3.6.4.min.js"></script>
99
{% set assets = page_assets.get(pagename, {}) %}
10+
{% if assets is defined and assets|length > 0 %}
1011
{% if assets.get("needs_datatables") %}
1112
<link href="https://cdn.datatables.net/v/dt/dt-2.2.0/datatables.min.css" rel="stylesheet">
1213
<script src="https://cdn.datatables.net/v/dt/dt-2.2.0/datatables.min.js"></script>
1314
{% endif %}
15+
{% endif %}
1416

1517
{% if theme_show_breadcrumbs %}
1618
<link href="{{ pathto('_static/css/breadcrumbs.css', 1) }}" rel="stylesheet" />
@@ -36,12 +38,14 @@
3638

3739
<!-- Include desired assets -->
3840
{% set assets = page_assets.get(pagename, {}) %}
41+
{% if assets is defined and assets|length > 0 %}
3942
{% if assets.get("needs_datatables") %}
4043
<script>
4144
$(document).ready(function () {
4245
$("table.datatable").DataTable();
4346
});
4447
</script>
4548
{% endif %}
49+
{% endif %}
4650

4751
{%- endblock %}

0 commit comments

Comments
 (0)