Skip to content

Add GitHub README component via content loader#158

Merged
just-be-dev merged 14 commits intomainfrom
just-be/ccpm-project
Jan 19, 2026
Merged

Add GitHub README component via content loader#158
just-be-dev merged 14 commits intomainfrom
just-be/ccpm-project

Conversation

@just-be-dev
Copy link
Owner

Summary

Implement a content loader that fetches GitHub READMEs from projects with GitHub repositories and renders them using Astro's renderMarkdown(). The new ::readme MDC component enables embedding project READMEs directly in project pages.

The loader automatically discovers projects with GitHub repository URLs, fetches their README files at build time, and stores them in a new readmes collection. This approach uses Astro's markdown pipeline for consistent syntax highlighting and plugin support.

Changes

  • New content loader (src/loaders/readme-loader.ts) that discovers and fetches GitHub READMEs
  • New ::readme MDC component (src/components/Readme.astro) for embedding READMEs
  • CCPM project page now uses the README component
  • Updated skill documentation to clarify repository URL requirements

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jan 19, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
just-be-dev 7a0b172 Commit Preview URL

Branch Preview URL
Jan 19 2026, 05:35 PM

just-be-dev and others added 4 commits January 19, 2026 11:10
Implement a content loader that fetches GitHub READMEs from projects and renders them using Astro's renderMarkdown(). Adds a ::readme MDC component for embedding project READMEs, and updates the CCPM project page to use it.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Avoid circular dependency by parsing project frontmatter directly from filesystem instead of importing astro:content within the loader.
Replace build-time README loader with live content collection that fetches
from GitHub API at runtime. This enables always-fresh README content without
requiring rebuilds.

Changes:
- Enable experimental liveContentCollections flag
- Create github-readme-live-loader.ts using GitHub API
- Add src/live.config.ts for live collections
- Update Readme component to use getLiveEntry()
- Set prerender=false on project detail pages for SSR
- Remove old build-time loader
- Add marked dependency for markdown parsing

The loader defaults to just-be-dev org but accepts owner parameter to
fetch READMEs from other GitHub users/orgs.
just-be-dev and others added 10 commits January 19, 2026 11:42
Changed collection name to singular form for consistency with
other collections (blog, projects, research, talks, etc.).

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Remove the first H1 from README content to avoid duplicate
headings on project pages. The project page already displays
the project title as H1, so the README H1 (typically the
repo name) is redundant.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add custom marked renderer to apply Link component styling
to all links in READMEs:
- Bold, underlined styling with hover effects
- External links open in new tab with rel="noopener noreferrer"
- External links get arrow indicator (↗)

This ensures README links match the site's link styling
without requiring the Link component.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Replace the marked custom renderer approach with pure CSS styling
in the Readme component. This is cleaner and more maintainable:
- CSS handles all link styling (color, bold, underline, hover effects)
- CSS ::after pseudo-element adds external link arrow indicator
- Small client script sets target="_blank" on external links

This separates concerns: the loader renders markdown, and the
component handles presentation.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Move the external link handling from client-side JavaScript to
the marked renderer. External links now get target="_blank" and
rel="noopener noreferrer" at render time instead of via DOM
manipulation.

This is more efficient and ensures the attributes are present
in the initial HTML.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
The scoped <style> block in Readme.astro wasn't working because
content inserted with set:html bypasses Astro's style scoping.

Moved link styles to src/styles/global.css where they properly
apply to dynamically rendered README content.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@just-be-dev just-be-dev merged commit f5528f0 into main Jan 19, 2026
2 checks passed
@just-be-dev just-be-dev deleted the just-be/ccpm-project branch January 19, 2026 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant