Learn how to manage resource collections including books, tech stack, and desktop setup using JSON data files
Resources are managed through JSON data files that are loaded as Astro content collections. These collections power your resources pages including book recommendations, tech stack showcase, and desktop setup details.
Edit src/data/books.json and add a new entry to the array:
{ "id": "clean-code", "title": "Clean Code", "author": "Robert C. Martin", "image": "https://www.oreilly.com/covers/urn:orm:book:9780136083238/300w/", "description": "The definitive book on writing maintainable code. Uncle Bob's principles have shaped how I think about software craftsmanship.", "link": "https://www.oreilly.com/library/view/clean-code-a/9780136083238/"}
Edit src/data/tech-stack.json and add a new entry:
{ "id": "python", "name": "Python", "image": "https://cdn.jsdelivr.net/gh/devicons/devicon/icons/python/python-original.svg", "description": "My primary backend language. Versatile, powerful, and perfect for everything from web APIs to data processing and automation scripts.", "link": "https://www.python.org/"}
Use Devicon for consistent, high-quality technology logos. The CDN URL format is: https://cdn.jsdelivr.net/gh/devicons/devicon/icons/{name}/{name}-original.svg
{ "id": "django", "name": "Django", "image": "https://cdn.jsdelivr.net/gh/devicons/devicon/icons/django/django-plain.svg", "description": "The web framework for perfectionists with deadlines. Batteries-included approach means I can focus on building features, not boilerplate.", "link": "https://www.djangoproject.com/"}
Edit src/data/desktop-setup.json and add a new entry:
{ "id": "macbook-pro", "name": "MacBook Pro 14\"", "image": "https://images.unsplash.com/photo-1517336714731-489689fd1ca8?w=400&h=300&fit=crop", "description": "M3 Max chip with 36GB RAM and 1TB SSD. The powerhouse that handles everything from development to video editing without breaking a sweat.", "link": "https://support.apple.com/en-ke/117736"}
{ "id": "macbook-pro", "name": "MacBook Pro 14\"", "image": "https://images.unsplash.com/photo-1517336714731-489689fd1ca8?w=400&h=300&fit=crop", "description": "M3 Max chip with 36GB RAM and 1TB SSD. The powerhouse that handles everything from development to video editing without breaking a sweat.", "link": "https://support.apple.com/en-ke/117736"}
In your Astro components, query resource collections like any other content collection:
import { getCollection } from 'astro:content';// Get all booksconst books = await getCollection('books');// Get all tech stack itemsconst techStack = await getCollection('techStack');// Get all desktop setup itemsconst desktopSetup = await getCollection('desktopSetup');