Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions _template/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<html lang="ja">
<head>
<meta charset="UTF-8">
<!-- 注意: <title> と <meta name="description"> はルートの sitemap.xml / llms.txt /
index.html / README.md の講義一覧に自動転記されます(scripts/sync_listings.py)。
listing にそのまま載る前提で、短く・的確に書いてください。 -->
<!-- 注意: 直下の title 要素と meta description はルートの sitemap.xml /
llms.txt / index.html / README.md の講義一覧に自動転記されます
(scripts/sync_listings.py)。listing にそのまま載る前提で、短く・的確に。 -->
<title>{{ 講義タイトル }} — Lectures</title>
<meta name="description" content="{{ 1〜2 文の概要。検索・GEO 用。160 字以内で、この回が扱う機能と読者の得るものを書く }}">
<meta name="author" content="@watanabe-kohei-jp">
Expand Down
9 changes: 8 additions & 1 deletion scripts/sync_listings.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@
re.DOTALL,
)
SECTION_RE = re.compile(r"<section[\s>]")
HTML_COMMENT_RE = re.compile(r"<!--.*?-->", re.DOTALL)


def strip_html_comments(page: str) -> str:
"""Remove HTML comments so TITLE_RE / META_DESC_RE / SECTION_RE do not
misfire on tag-like text quoted inside <!-- ... -->."""
return HTML_COMMENT_RE.sub("", page)


def repo_root() -> Path:
Expand Down Expand Up @@ -119,7 +126,7 @@ def discover_lectures(root: Path) -> list[Lecture]:
f"ERROR: {child.name}/ matches the lecture naming pattern "
f"but has no index.html"
)
page = idx.read_text(encoding="utf-8")
page = strip_html_comments(idx.read_text(encoding="utf-8"))
lectures.append(Lecture(
num=m.group(1),
slug=m.group(2),
Expand Down
Loading