Markdown Converter
Agent skill for markdown-converter
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Sign in to like and favorite skills
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
AIHeadline.news is an automated AI news aggregation site built with Hugo and the Hextra theme. Content is dynamically generated from the
ai-briefing-archive repository and deployed to both Cloudflare Workers and GitHub Pages.
Key Architecture Principle:
content/ and source-news/ directories are NOT committed to git. They are dynamically generated during CI/CD builds by fetching and processing external news data.
# Quick start: Sync content and start dev server bash .github/scripts/dev.sh # Manually fetch latest news data ./.github/scripts/update-source-news.sh # Sync content to Hugo format ./.github/scripts/sync-news.sh --mode=auto # Start Hugo development server hugo server # Build static site hugo --gc --minify # Start Cloudflare Worker development (requires .dev.vars with GA4_SERVICE_KEY) npm run dev
--mode=auto - Auto-detect: incremental if changes detected, else full--mode=full - Full rebuild of all content--mode=incremental - Only sync changed dates (use with --dates=YYYYMMDD,...)Source Fetch (
update-source-news.sh):
ai-briefing-archive repo into source-news/--depth=1) for efficiency.source-news-metaContent Transformation (
sync-news.sh):
source-news/YYYY/MM/source-slug/briefing_YYYYMMDDTHHMMSS*.md filescontent/YYYY-MM/YYYY-MM-DD.md_index.md)Dual Build System:
public-worker/ with base URL https://aiheadline.newspublic-pages/ with dynamic base URL from ActionsCritical Theme Constraint: All content pages inherit
cascade: type: docs from content/_index.md. This affects:
.RegularPages collection (excludes docs-type pages in some contexts)RSS Feed Specifics:
layouts/index.rss.xml (NOT layouts/_default/rss.xml)site.RegularPages directly for homepage RSSrssFullContent = true to include full HTML contenthugo.toml)The
_worker.ts file implements:
env.ASSETSEnvironment Variables Required:
GA4_SERVICE_KEY - Full GA4 service account JSON (single-line string)GA4_PROPERTY_ID - Numeric GA4 property IDGA_START_DATE - Optional start date for cumulative stats (YYYY-MM-DD)Symptom:
index.xml contains channel info but no <item> elements
Cause: Wrong RSS template location or page collection method
Solution:
layouts/index.rss.xml (not _default/rss.xml)site.RegularPages.ByDate.Reverse for homepage feedtype: docs from cascadeSymptom: New briefings don't appear after deployment Cause: Content sync script failed or source repo not updated Debug:
update-source-news.sh stepsync-news.sh output shows expected date processingSymptom: Build fails with "module not found" for Hextra theme Solution: Hugo automatically downloads modules on first build. Ensure:
go.mod and go.sum are committedgithub.com/imfing/hextralayouts/ ├── index.rss.xml # Homepage RSS feed (CRITICAL: must be this exact path) ├── _default/ │ ├── list.markdown # Markdown output format │ └── single.markdown ├── partials/ │ └── custom-head.html # GA4 + AdSense injection └── shortcodes/ # Custom Hugo shortcodes
Git-Ignored Directories:
content/ - Generated by sync-news.shsource-news/ - Cloned from ai-briefing-archivepublic/, public-worker/, public-pages/ - Build outputs.cache/hugo_cache/ - Hugo build cacheGitHub Actions triggers on:
main branchBuild produces two independent artifacts:
Both use the same Hugo source but different base URLs.
From
hugo.toml:
github.com/imfing/hextra)services.rss.limit)params.rssFullContent = true)zh-cn) with CJK language supportcontent/ inherit type: docsRSS Feed Fix Journey:
layouts/_default/rss.xml - didn't worktype: docs - still emptysite.RegularPages - no effectlayouts/index.rss.xml - immediately workedLesson: Hugo's template lookup order prioritizes page-kind-specific templates (
index.rss.xml) over default templates. For homepage RSS with themes that use custom page types, use the explicit index.rss.xml path.