
Homepage Cleanup & Dynamic Content Loading - Day 23
So here's the thing - I've been building this travel directory for Bali, and yesterday I realized my homepage looked... well, pretty messy. You know that feeling when you've been coding for weeks and suddenly step back to see what users actually experience? Yeah, that was me.
Quick summary
Day 23 of my 60-day challenge was all about homepage cleanup and getting dynamic content to actually load properly. What should have been simple fixes turned into a rabbit hole of database queries, category filtering, and me questioning my life choices. But hey, that's the fun part, right?
Why I'm sharing this
Living here in Bali while building a travel site has taught me that sometimes the smallest details make the biggest difference. A homepage that doesn't load properly? That's basically telling visitors to leave immediately. Plus, I'm documenting this whole journey because I wish someone had shared the messy reality of building stuff when I was starting out.
The challenge I was facing
My homepage had this accommodation section that wasn't loading any properties. The activities section was empty (even though I had dining places ready to show). And don't get me started on the hero section - there was so much padding it looked like I was afraid of my own content.
But here's what really got me: I had this "featured" functionality in my database that wasn't working. You know, those special listings you want to highlight? Yeah, they were just sitting there, unfeatured and sad.
What I tried first (spoiler: it didn't work)
I thought, "Okay, simple fix - just adjust the padding and connect the database properly."
Famous last words.
First, I dove into the CSS to fix that massive padding issue. The hero section had so much white space it looked like a minimalist art project gone wrong. I'm talking 4K screen levels of unnecessary space.
Then I tried to get the featured stays loading. I had this nice database column called "featured" with true/false values, and I figured it would be straightforward to filter by that.
Plot twist: it wasn't.
The breakthrough moment
After about an hour of banging my head against the keyboard (metaphorically - my MacBook is too expensive for actual head-banging), I realized the issue wasn't just about filtering by "featured."
I had parent categories and subcategories in my database. So when I was filtering for "stays," I needed to look at the category type, not just the category ID. It's like trying to find all the red cars in a parking lot but only looking at license plates instead of, you know, the actual color.
Here's how I actually built it
Step 1: Fixed the padding nightmare
This was actually the easy part. I opened up the homepage component and found where all that extra padding was coming from. Sometimes it's margin, sometimes it's padding - this time it was definitely padding being way too generous.
/* Before: Hero section with enough space to land a helicopter */
/* After: Actually reasonable spacing that doesn't waste screen real estate */
The fix was simple once I found it, but finding it took longer than I'd like to admit.
Step 2: Got the featured stays actually loading
Here's where it got interesting. My database structure had:
A listings table with a "featured" column (true/false)
A categories table with parent/child relationships
Category types like "accommodation," "dining," "activities"
I needed to filter by both the featured status AND the category type. The query ended up looking something like this:
SELECT * FROM listings
WHERE featured = true
AND category_type = 'accommodation'
But getting Cursor AI to understand this took a few back-and-forth conversations. I literally had to take screenshots of my database structure and say "please check this screenshot" because explaining it in words wasn't working.
Step 3: Changed activities to dining (because logic)
I realized I was showing an "activities" section when I didn't have any activities loaded yet, but I had a bunch of dining places ready to go. So I changed the section title to "Unforgettable dining experiences" and filtered for category type "dining" instead.
This is where I learned something interesting about my own database design - some restaurants might have multiple categories (breakfast, lunch, dinner), so I needed to make sure my filtering could handle that complexity.
Step 4: Added a proper image gallery
The individual listing pages had multiple images, but they weren't displaying anywhere. I asked Cursor to create a lightweight gallery component that would show under the "pro tips" section.
This actually worked better than expected. Sometimes the AI just gets it right on the first try, and you sit there wondering why other things take forever.
The stuff that went wrong
Oh boy, where do I start?
First, the featured filtering kept showing "no featured stays found" even though I definitely had featured stays in the database. Turns out I was overthinking the category relationships and hardcoding values that didn't match my actual data.
Then, when I got the stays working, the dining section started showing accommodation listings too. It was like my filters were having an identity crisis.
And don't get me started on the location data not displaying properly. It was working fine on individual listing pages but refusing to show up on the homepage cards. Classic development problem - it works everywhere except where you actually need it.
How I fixed the problems
The featured stays issue got solved when I stopped trying to be clever and just focused on the basics: filter by featured = true AND category type = accommodation. Sometimes the simple approach is the right approach.
For the dining section showing wrong content, I had to make sure each section had its own distinct filtering logic. No sharing queries between sections, even if they look similar.
The location display got fixed by literally copying how I was fetching location data on the individual listing pages. If it works in one place, just replicate it exactly. Don't try to reinvent the wheel.
What it looks like now
My homepage actually looks like a real travel site now. The hero section has proper spacing (no more helicopter landing pad vibes). The featured stays section loads actual properties from Bali. The dining section shows restaurants and cafes instead of random placeholder content.
I still need to add better images - some of the photos look like they were taken with a potato from 2010. But the functionality is there, and that's what matters for now.
Lessons I'm taking from this
Database relationships are more complex than they seem, especially when you're building them incrementally
Sometimes you need to step back and look at what users actually see, not just what your code is doing
Taking screenshots for AI tools works better than trying to describe complex database structures in words
Simple solutions often work better than clever ones
Having a "featured" flag in your database is only useful if you actually use it properly
What I'm working on next
Next episode, I'm going to focus on uploading real content. My partner has been taking amazing photos around Bali, so I want to get those into the system and see how the site looks with actual high-quality images instead of placeholders.
I also need to build out the category pages properly and fix all the filtering functionality. Plus, I want to add that map feature where different colored pins show accommodations, dining, and activities. That could be really useful for people planning their Bali trip.
Final thoughts
You know what's funny? I used to think the hard part of building a travel site would be the complex features - the booking systems, the payment processing, the user accounts. But it's actually these little details that take forever. Getting content to load properly, making sure filters work correctly, ensuring the homepage doesn't look like a design disaster.
But that's also what makes it interesting. Every small fix teaches you something new about your own system. And when you finally get that featured content loading properly, it feels like a genuine win.
Following along with my 60-day Bali travel site challenge? The messy reality of building stuff is way more interesting than the polished tutorials, don't you think?