diff --git a/bots/publisher_bot.py b/bots/publisher_bot.py index d3f3193..f909a06 100644 --- a/bots/publisher_bot.py +++ b/bots/publisher_bot.py @@ -322,7 +322,9 @@ def build_full_html(article: dict, body_html: str, toc_html: str) -> str: ) html_parts.append(json_ld) - if toc_html: + # 목차는 h2가 3개 이상일 때만 표시 (짧은 글에선 불필요) + h2_count = body_html.lower().count('= 3: html_parts.append(f'
{toc_html}
') html_parts.append(body_html)