fix: Substack essays working in CI + iframe fallback + improved essay cards - #3
Merged
Merged
Conversation
… + improved essay cards - Remove API key gate: public Substack /api/v1/posts works without auth, so skip the substackApiKey check that was blocking all CI fetches - Pass substackHandle through to component for use in fallback - Iframe embed fallback: when API returns no essays (e.g. blocked fetch), render the Substack embed widget instead of an empty list - Essay cards: cover image thumbnail, inline Substack source badge, flex layout so image+text sit side by side - Add netlify.toml so Netlify deploy previews trigger on PRs https://claude.ai/code/session_01P9Bn6gkWtM15yEzGf79XCQ
❌ Deploy Preview for soft-swan-5d0ce7 failed. Why did it fail? →
|
❌ Deploy Preview for darling-dusk-441006 failed. Why did it fail? →
|
Seems to be breaking the deploys
Iframe now renders as a supplement below local posts when substackEssays is empty, rather than replacing the whole list. Local posts always show. https://claude.ai/code/session_01P9Bn6gkWtM15yEzGf79XCQ
- deploy.yml: replace actions/deploy-pages (GitHub Actions source) with
peaceiris/actions-gh-pages so production lands on the gh-pages branch.
Required for PR preview subdirs to coexist with the production root.
- pr-preview.yml: new workflow using rossjrw/pr-preview-action. Builds
the site with NEXT_PUBLIC_BASE_PATH=/pr-preview/pr-{N} so Next.js
basePath/assetPrefix resolve correctly inside the subdir. Posts the
preview URL as a PR comment automatically; cleans up on PR close.
NOTE: requires one settings change in the GitHub repo →
Settings > Pages > Source → "Deploy from a branch" → gh-pages / root
https://claude.ai/code/session_01P9Bn6gkWtM15yEzGf79XCQ
…LIC_BASE_PATH are unset Both getEnv() calls lacked a default value, causing an immediate throw at module load time during next build — before getStaticProps even runs. - resolve-arena-channels.ts: ARENA_PERSONAL_ACCESS_TOKEN defaults to "" so the module loads; empty token skips auth (API call fails gracefully inside the existing try/catch that returns []) - _document.tsx: NEXT_PUBLIC_BASE_PATH defaults to ""; base href tag is only rendered when the value is actually set, avoiding a pointless <base href=""> as well as the throw https://claude.ai/code/session_01P9Bn6gkWtM15yEzGf79XCQ
tsconfig.json reformatted by Next.js (no semantic change); package.json has a few ^ ranges resolved to exact versions by npm during install. https://claude.ai/code/session_01P9Bn6gkWtM15yEzGf79XCQ
Reverts the peaceiris/actions-gh-pages change back to the original actions/upload-pages-artifact + actions/deploy-pages two-job setup. PR preview via rossjrw/pr-preview-action requires this to change but will be revisited separately. https://claude.ai/code/session_01P9Bn6gkWtM15yEzGf79XCQ
4 tasks
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.
Problem
Substack essays were never fetching in CI because the code gated the entire API call behind
if (substackHandle && substackApiKey). The Substack/api/v1/postsendpoint is a public API that doesn't require authentication — the API key was never actually needed for the fetch to work. SinceSUBSTACK_API_KEYwasn't in GitHub Secrets (or was invalid), CI always skipped the fetch and rendered an empty list.Changes
Bug fix — always fetch from public API (
pages/index.tsx)Removed the
substackApiKeyrequirement from the fetch gate. The API key is still passed through as an optional header if present, but the fetch now happens unconditionally when a handle is available.Fallback — Substack iframe embed
When the combined essay list (local posts + Substack) is empty (e.g. fetch blocked by network policy), the page now renders the official Substack embed widget instead of a blank section.
Improved essay cards
cover_imagenow show a 72×56px thumbnailSUBSTACKpill badge inline with the titlenetlify.tomlAdded so Netlify deploy previews trigger automatically on PRs. The build command matches the existing GitHub Actions setup (
npm run build && npm run export, publish dirout).Test plan
cover_imageSUBSTACKbadge appears on all Substack-sourced essayshttps://claude.ai/code/session_01P9Bn6gkWtM15yEzGf79XCQ
Generated by Claude Code