diff --git a/bots/converters/blog_converter.py b/bots/converters/blog_converter.py index 4c4cdd2..3e5efab 100644 --- a/bots/converters/blog_converter.py +++ b/bots/converters/blog_converter.py @@ -96,10 +96,16 @@ def build_full_html(article: dict, body_html: str, toc_html: str, json_ld = build_json_ld(article, post_url) disclaimer = article.get('disclaimer', '') parts = [json_ld] - # 목차: h2가 3개 이상인 긴 글에서만 표시 + # 목차: h2가 3개 이상이고 TOC에 실제 링크가 있을 때만 표시 h2_count = body_html.lower().count('
{disclaimer}
') diff --git a/bots/publisher_bot.py b/bots/publisher_bot.py index 6aefe3b..2a84f79 100644 --- a/bots/publisher_bot.py +++ b/bots/publisher_bot.py @@ -376,6 +376,16 @@ def fetch_featured_image(article: dict) -> str: return '' +def _insert_toc_after_image(body_html: str, toc_block: str) -> str: + """본문에 대표이미지가 있으면 이미지 뒤에, 없으면 맨 앞에 TOC 삽입""" + import re as _re + # 본문 시작이