diff --git a/src/calibre/ebooks/metadata/book/render.py b/src/calibre/ebooks/metadata/book/render.py
index 33eef885bc..9f8a2b4147 100644
--- a/src/calibre/ebooks/metadata/book/render.py
+++ b/src/calibre/ebooks/metadata/book/render.py
@@ -420,37 +420,31 @@ def mi_to_html(
if not metadata.get('display', {}).get('is_names', False):
all_vals = sorted(all_vals, key=sort_key)
links = []
- if show_links:
- for x in all_vals:
- if metadata['is_custom']:
- u, v = cc_search_action_with_data(field, x, book_id, metadata, mi, field)
- v = f'{p(x)}'
- else:
- v = '{}'.format(
- search_action_with_data(st, x, book_id, field),
- _('Click to see books with {0}: {1}').format(
- metadata['name'] or field, a(x)), p(x))
- v += add_other_links(field, x)
- links.append(v)
- else:
- links = all_vals
+ for x in all_vals:
+ if metadata['is_custom']:
+ u, v = cc_search_action_with_data(field, x, book_id, metadata, mi, field)
+ v = f'{p(x)}'
+ else:
+ v = '{}'.format(
+ search_action_with_data(st, x, book_id, field),
+ _('Click to see books with {0}: {1}').format(
+ metadata['name'] or field, a(x)), p(x))
+ v += add_other_links(field, x)
+ links.append(v)
val = value_list(metadata['is_multiple']['list_to_ui'], links)
else:
try:
st = metadata['search_terms'][0]
except Exception:
st = field
- if show_links:
- if metadata['is_custom']:
- u, v = cc_search_action_with_data(st, unescaped_val, book_id, metadata, mi, field)
- v = f'{p(unescaped_val)}'
- else:
- v = '{}'.format(
- search_action_with_data(st, unescaped_val, book_id, field),
- _('Click to see books with {0}: {1}').format(
- metadata['name'] or field, a(unescaped_val)), p(unescaped_val))
+ if metadata['is_custom']:
+ u, v = cc_search_action_with_data(st, unescaped_val, book_id, metadata, mi, field)
+ v = f'{p(unescaped_val)}'
else:
- v = val
+ v = '{}'.format(
+ search_action_with_data(st, unescaped_val, book_id, field),
+ _('Click to see books with {0}: {1}').format(
+ metadata['name'] or field, a(unescaped_val)), p(unescaped_val))
val = v + add_other_links(field, val)
elif metadata['datatype'] == 'enumeration':
u, v = cc_search_action_with_data(field, unescaped_val, book_id, metadata, mi, field)