Forum: read-only, SEO-indexed mirror of GitHub Discussions#30
Merged
Conversation
…tic pages + live refresh
|
Tip |
…er); drop redundant live-fetch proxy
…comments, rebuild only on discussion changes, copy cleanup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A community forum where all writing happens on GitHub (topics + comments + moderation + @mentions), and the site is a read-only, SEO-indexed mirror. Good Q&A pulls people in from Google.
How it works
src/lib/forum.tsfetches discussions + comments via GitHub GraphQL (bodyHTML, so @mentions/code/images render exactly as GitHub does) and bakes them into static HTML. Fully defensive — no token, a fetch error, or empty Discussions all yield an empty forum (warning, never a broken build)./api/discussion/[number](a token-holding Cloudflare Function proxy) so anything posted since the last build appears. Any failure leaves the baked-in comments in place. Progressive enhancement — data is always in the HTML.Pages
/forum— all threads, paginated (reusesPager), with category chips./forum/c/[category]— per-category hub, paginated (SEO surface per section)./forum/[category]/[slug]— thread: original post + comments (capped 50,commentCountreports the true total),DiscussionForumPosting/QAPageschema.org, "Reply on GitHub" CTA.Categories
Auto-discovered from GitHub — nothing hardcoded. The giscus Comments category is excluded (those are blog comments, not forum threads).
Freshness
.github/workflows/forum-sync.ymlfires the Cloudflare Deploy Hook ondiscussion/discussion_commentevents + a daily cron.Setup needed to go live
GITHUB_TOKEN(read-only) in the Cloudflare Pages build env and Functions env.CLOUDFLARE_DEPLOY_HOOK_URLrepo secret for the sync workflow.Verified: builds green with no token (empty state) and with a real token; confirmed a real discussion renders as a thread with baked-in comments + schema.org + live-refresh hook. 62 tests pass.