fix(channels): health page baked empty stats — data-key filename mismatch - #2167
Merged
Conversation
…erscore)
Hugo does not convert hyphens to underscores in data filenames (the Phase 1
plan's premise was wrong). fetch-channels-stats.ts wrote channels-stats.json
but the health layout reads .Site.Data.channels_stats, so the key never
resolved and the page baked {} → 'Total channels: 0'. Rename the output to
channels_stats.json, matching the sibling convention (channel_collections.json,
verb_definitions.json). Layout unchanged. Verified: baked stats now total=236.
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
The Phase 1
/channels/health/page shipped showing "Total channels: 0" on DEV. Thechannels-healthisland reads baked#channels-stats-data, which the Hugo layout injects from.Site.Data.channels_stats. That key never resolved →default dict→{}.Root cause
fetch-channels-stats.tswrotehugo/data/channels-stats.json(hyphen). Hugo 0.147 does not convert hyphens to underscores in data filenames (PR #2166's plan premise was wrong — every working sibling script writes an underscore filename:channel_collections.json,verb_definitions.json,topic_clusters.json). So the file was exposed under keychannels-stats, notchannels_stats.The data, the
/build/channels-statsendpoint (returns total=236), and the media-diet surface were all fine — only the health page's data binding was dead.Fix
scripts/fetch-channels-stats.ts: outputhugo/data/channels_stats.json(underscore), matching layout + sibling convention. Layout unchanged.hugo/data/.gitignore: track the renamed artifact name.Verification
Local rebuild after fix: baked
#channels-stats-datanow{"activeVsInactive":{"active":231,"inactive":5},..."total":236};<noscript>reads "Total channels: 236"; page 64400→68469 bytes. Will confirm live on DEV after deploy.