Repository navigation
fix: curated resources on topic pages and real library totals - #36
Merged
Merged
Conversation
Every topic page showed "0 curated resources" and the library totals said 13. Two causes: - Liquid 4 cannot parse nested brackets: site.data[lang][url_parts[2]] read the key "url_parts[2" and found nothing, so topic pages never received their data. The path parts and the resource type are now assigned to variables first. - components/atoms/real-resources.html walked two levels, but curated resources live three levels down (language → category → subcategory → file). It now reads all three. Library totals (footer and the categories page) come from _plugins/resource_stats.rb, computed once per build instead of walking every data file from the footer of each of ~580 pages. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Deploying iplibrary-website with
|
| Latest commit: |
1ab867b
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://05cc5805.iplibrary-website.pages.dev |
| Branch Preview URL: | https://fix-resource-counts.iplibrary-website.pages.dev |
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.
The live site showed 0 curated resources on every category and subcategory page, and 13 resources in the library totals, although the data holds about 4,200 entries.
Causes
site.data[lang][url_parts[2]]: it reads the keyurl_parts[2and returns nothing, so_layouts/topic.htmlnever received its data. Fixed by assigningcategory_key,subcategory_keyandrt_keyfirst.components/atoms/real-resources.htmlwalked two levels, but curated resources sit three levels down (language → category → subcategory → file). It now reads all three.Totals
_plugins/resource_stats.rbcounts unique curated resources per language once per build (site.data.resource_stats). The footer and the categories page read it, instead of walking every data file from the footer of each of ~580 pages.Checked
Rendered in a Ruby 3.2.2 container with the project's gems:
/pt-BR/marketing/seo//pt-BR/marketing//en-US/computing/natural-language-processing/The new tests in
test/build_output_test.rbcover the subcategory listing and the totals.🤖 Generated with Claude Code