feat: 블로그 글 하단에 원문 출처 링크 표시
- 본문 끝에 출처 박스 추가 (배경색 + 좌측 보더) - sources 배열과 source_url 모두 표시 - 중복 URL 제거, 새 탭 열기(target=_blank) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -301,8 +301,32 @@ def build_full_html(article: dict, body_html: str, toc_html: str) -> str:
|
|||||||
if toc_html:
|
if toc_html:
|
||||||
html_parts.append(f'<div class="toc-wrapper">{toc_html}</div>')
|
html_parts.append(f'<div class="toc-wrapper">{toc_html}</div>')
|
||||||
html_parts.append(body_html)
|
html_parts.append(body_html)
|
||||||
|
|
||||||
|
# 원문 출처 링크
|
||||||
|
sources = article.get('sources', [])
|
||||||
|
source_url = article.get('source_url', '')
|
||||||
|
source_name = article.get('source_name', '') or article.get('source', '')
|
||||||
|
if sources or source_url:
|
||||||
|
html_parts.append('<hr/>')
|
||||||
|
html_parts.append('<div class="source-info" style="margin:1.5em 0;padding:1em;'
|
||||||
|
'background:#f8f9fa;border-left:4px solid #ddd;border-radius:4px;'
|
||||||
|
'font-size:0.9em;color:#555;">')
|
||||||
|
html_parts.append('<b>📌 원문 출처</b><br/>')
|
||||||
|
seen = set()
|
||||||
|
if sources:
|
||||||
|
for src in sources:
|
||||||
|
url = src.get('url', '')
|
||||||
|
title = src.get('title', '') or url
|
||||||
|
if url and url not in seen:
|
||||||
|
seen.add(url)
|
||||||
|
html_parts.append(f'• <a href="{url}" target="_blank" rel="noopener">{title}</a><br/>')
|
||||||
|
if source_url and source_url not in seen:
|
||||||
|
label = source_name or source_url
|
||||||
|
html_parts.append(f'• <a href="{source_url}" target="_blank" rel="noopener">{label}</a><br/>')
|
||||||
|
html_parts.append('</div>')
|
||||||
|
|
||||||
if disclaimer:
|
if disclaimer:
|
||||||
html_parts.append(f'<hr/><p class="disclaimer"><small>{disclaimer}</small></p>')
|
html_parts.append(f'<p class="disclaimer"><small>{disclaimer}</small></p>')
|
||||||
|
|
||||||
return '\n'.join(html_parts)
|
return '\n'.join(html_parts)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user