diff --git a/web/core/views.py b/web/core/views.py index 5104d54..04854b6 100644 --- a/web/core/views.py +++ b/web/core/views.py @@ -66,6 +66,18 @@ def entry_context(entry, result_ids): scripture_list = [ t.strip() for t in (entry.scripture_raw or "").split(";") if t.strip() ] + + # NEW: compute talk PDF URL if present and the file exists + talk_pdf_url = None + try: + if entry.talk_number: + filename = f"talk_pdfs/S-34_E_{int(entry.talk_number):03d}.pdf" + if staticfiles_storage.exists(filename): + talk_pdf_url = staticfiles_storage.url(filename) + except Exception: + # fail gracefully; leave talk_pdf_url as None + pass + return { "entry": entry, "locked": True, @@ -73,6 +85,8 @@ def entry_context(entry, result_ids): "count": count, "subject_list": subject_list, "scripture_list": scripture_list, + # NEW + "talk_pdf_url": talk_pdf_url, }