diff --git a/site/.gitignore b/site/.gitignore index 1da12d8ae..556e3b841 100644 --- a/site/.gitignore +++ b/site/.gitignore @@ -7,6 +7,7 @@ blog/feed.xml changelist.html news/ files/news.json +files/blog.json # Playground: vendored from web/ui/src/ for local-dev preview only. # CI rebuilds these from source on every publish. To preview locally: diff --git a/site/blog/build_blog.py b/site/blog/build_blog.py index 30e1f87ee..e30796bdc 100644 --- a/site/blog/build_blog.py +++ b/site/blog/build_blog.py @@ -536,6 +536,19 @@ def main(): (out / 'files' / 'news.json').write_text( json.dumps(top_news, indent=2), encoding='utf-8') + # 7. blog.json — drives the "N NEW" nav chip. baseline_date is the + # date of the second-newest post: a first-time visitor (no + # localStorage) sees exactly one post counted as new (the newest). + newest_date = posts[0].date if posts else '1970-01-01' + baseline_date = posts[1].date if len(posts) >= 2 else '1970-01-01' + blog_data = { + 'newest_date': newest_date, + 'baseline_date': baseline_date, + 'posts': [{'slug': p.slug, 'date': p.date} for p in posts], + } + (out / 'files' / 'blog.json').write_text( + json.dumps(blog_data, indent=2), encoding='utf-8') + print(f"built {len(posts)} posts, {len(news)} news entries → {out}/") diff --git a/site/blog/template.html b/site/blog/template.html index e3cf7b666..5c9ee9fc3 100644 --- a/site/blog/template.html +++ b/site/blog/template.html @@ -12,6 +12,11 @@ + + + +