Skip to content

Commit 60d8ccc

Browse files
committed
Fix crash when an entry has no text pages
1 parent 8a72a05 commit 60d8ccc

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

noxfile.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,11 @@ def dummy_setup(session: nox.Session):
301301
"sortnum": 0,
302302
"flag": "foo:bar",
303303
},
304+
"categories/empty.json": {
305+
"name": "Empty",
306+
"icon": "minecraft:glass_pane",
307+
"description": "Empty category",
308+
},
304309
"categories/disabled.json": {
305310
"name": "Disabled",
306311
"icon": "minecraft:bedrock",
@@ -541,6 +546,12 @@ def dummy_setup(session: nox.Session):
541546
},
542547
],
543548
},
549+
"entries/empty.json": {
550+
"name": "Empty entry",
551+
"category": "dummy:foo",
552+
"icon": "minecraft:glass_pane",
553+
"pages": [],
554+
},
544555
"entries/disabled.json": {
545556
"name": "Disabled",
546557
"category": "dummy:foo",

src/hexdoc/_templates/redirects/entry.html.jinja

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
{%- endblock title %}
99

1010
{% block description -%}
11-
{{ fmt_txt.styled(entry.first_text_page.text) }}
11+
{%- if entry.first_text_page -%}
12+
{{ fmt_txt.styled(entry.first_text_page.text) }}
13+
{%- endif -%}
1214
{%- endblock description %}
1315

1416
{% block image -%}

0 commit comments

Comments
 (0)