if (!$meta_tags) was never true — and Google noticed before we did
A few weeks after a release, Google Search Console started filling up. Duplicate without user-selected canonical — 68 URLs. Crawled – currently not indexed — 245. Discovered – not indexed — 62. And the pile grew, week over week. Nothing was down. No errors in the logs. The site worked. But Google was crawling a growing set of URLs it had no business indexing, and I couldn't see them in any report…
Google Search Console started filling up with duplicate URLs and indexed issues a few weeks after a release. URLs were pointing to deleted or inactive database records, which should have redirected to the appropriate section. However, the page would render as normal content without any proper canonical tags or meta information for Google to index. This led to 200 OK responses with empty head sections and missing title tags, making it impossible for Google to understand the page's purpose.
The code responsible for building page metadata relied on a shared helper function that merged the page data with meta data. If the metadata was missing, the function would return an empty array, causing the redirect to fail and allowing the page to be indexed regardless. This resulted in a silent failure for Google to know which URLs to crawl and index.
The fix involved checking for the presence of the title key in the $meta_tags array instead of checking if $meta_tags was truthy. By doing this, the guard would correctly redirect inactive or deleted URLs. The fix was implemented in 7 content controllers rather than the shared helper to avoid forcing unnecessary redirects onto call sites that didn't require them.
After deploying the fix, a 302 redirect was triggered for inactive items, and the issue was resolved. The coverage buckets in Google Search Console, such as Duplicate without canonical, Crawled/Discovered – not indexed, and 404, were recrawled within a 2-4 week cycle. This story highlights the importance of debugging SEO issues, as they often go unnoticed by monitoring systems and can only be detected through tools like Google Search Console.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.