Skip to content

Commit

Permalink
Fixed tags plugin crashing on numeric title
Browse files Browse the repository at this point in the history
  • Loading branch information
squidfunk committed Feb 5, 2025
1 parent a890d6e commit 4861c7d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion material/plugins/tags/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ def tag_name_casefold(tag: Tag, *args):

# Return item title for sorting
def item_title(mapping: Mapping):
return mapping.item.title
# Note that this must be coerced to a string, as the title might be sourced
# from metadata, which can be of any type - see https://t.ly/1AXyo
return str(mapping.item.title)

# Return item URL for sorting
def item_url(mapping: Mapping):
Expand Down
4 changes: 3 additions & 1 deletion src/plugins/tags/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ def tag_name_casefold(tag: Tag, *args):

# Return item title for sorting
def item_title(mapping: Mapping):
return mapping.item.title
# Note that this must be coerced to a string, as the title might be sourced
# from metadata, which can be of any type - see https://t.ly/1AXyo
return str(mapping.item.title)

# Return item URL for sorting
def item_url(mapping: Mapping):
Expand Down

0 comments on commit 4861c7d

Please sign in to comment.