Our Gemini Collaboration: A Deep Dive into Building a Better Blog
What happens when you pair a developer with a powerful AI assistant? This post documents my recent, in-depth collaboration with the Gemini CLI to analyze, enhance, and debug this very blog. It was a masterclass in AI-assisted development, covering everything from content creation to complex technical troubleshooting.
🚀 Phase 1: Understanding the Foundation
Our journey began with a simple request: “analyse the codebase.” This wasn’t just a surface-level scan. Gemini dug into the core of the project to build a comprehensive understanding.
- Configuration First: It started by reading the
config.yaml
file, immediately identifying the site as a Hugo project using the PaperMod theme. This initial step provided context for all future actions. - Content & Structure: Next, it listed the files in the
content/posts
directory and read one of the articles. This helped it grasp my writing style—informative, tech-focused, and using emojis for visual flair. - Deployment Pipeline: Finally, it examined the
.github/workflows/hugo.yml
file. This revealed the automated build and deployment process via GitHub Actions, confirming that the site was built in aproduction
environment and deployed to GitHub Pages.
With this solid foundation, we were ready to move on to more complex tasks.
✍️ Phase 2: Content Creation and SEO Nightmares
With a full picture of the blog, Gemini helped me create new content that matched my style, suggesting a trending topic: AI Agents. It generated a complete, well-written draft that I was able to use immediately.
But creating content is only half the battle. I mentioned that my posts weren’t appearing on Google. This kicked off a fascinating debugging process.
- The
robots.txt
Rabbit Hole: Gemini’s first suspect was therobots.txt
file. It correctly identified that the theme generates this file from a template (themes/PaperMod/layouts/robots.txt
). - The Production Check: It analyzed the template and found a critical piece of logic:
{{- if hugo.IsProduction }}...{{ else }} Disallow: / {{ end }}
. This meant the site would be blocked from indexing if not built in a production environment. Since our GitHub Actions workflow was using the production environment, this wasn’t the root cause. - The Sitemap Clue: The next clue was the sitemap URL in the
robots.txt
file, generated by{{ "sitemap.xml" | absURL }}
. This pointed to thebaseURL
inconfig.yaml
as a potential issue. A quick check confirmed mybaseURL
was correct. - The Diagnosis: With all the on-site configuration confirmed as correct, Gemini concluded that the issue was likely a delay in Google’s crawling. It recommended the definitive solution: registering the site with Google Search Console and submitting the sitemap directly. This is a crucial step for any new website to ensure timely indexing.
🔧 Phase 3: Advanced Troubleshooting - Analytics and Comments
With the indexing issue solved, we moved on to two more technical challenges.
Fixing Google Analytics
I had enabled Google Analytics in my config, but it wasn’t working. Here’s how we solved it:
- Finding the Hook: Gemini searched the theme files for “google” and found that
layouts/partials/head.html
was trying to include a partial namedgoogle_analytics.html
. - The Missing Piece: An attempt to read this file revealed it didn’t exist. This was a key insight: the theme provided a hook for analytics but deliberately did not ship with the tracking code itself. This is a smart design choice that prevents the theme from becoming outdated or forcing a specific analytics version on users.
- The Solution: Gemini created the missing file (
layouts/partials/google_analytics.html
) and populated it with the standard, modern GA4 tracking script. After committing this new file, my analytics started working perfectly.
Enabling Giscus Comments
The final challenge was enabling comments. The process was remarkably similar to fixing analytics.
- Another Missing Partial: I had set
comments: true
in my config, but nothing appeared. Gemini checked the theme’slayouts/partials/comments.html
and found it was just a placeholder file pointing to the Hugo documentation. - Creating the Implementation: Just like with analytics, the solution was to create our own
layouts/partials/comments.html
. Gemini generated the file with the necessary code to load Giscus, a fantastic commenting system that uses GitHub Discussions as a backend. - Configuration is Key: It also added the required
giscus
configuration block to myconfig.yaml
, reminding me to fill in therepoId
andcategoryId
from the Giscus website.
✨ Conclusion: A True Development Partner
This entire interaction was a powerful demonstration of how AI can be more than just a code generator. It was a true collaborator—analyzing, diagnosing, and solving complex, real-world problems. It understood the nuances of the Hugo framework, debugged deployment-specific issues, and helped me implement features that required a deep understanding of the theme’s architecture.
The age of the AI assistant is here, and as this experience shows, it’s an incredible time to be a developer.