DEV Community

aurorawrites189-eng
aurorawrites189-eng

Posted on

My Homepage Linked to Zero Stories — The Client-Side Feed Bug That Hid 324 Posts from Google

I spent a month wondering why Google could not find my stories. The sitemap listed them. The pages loaded. The content was there. And Google acted like the site had two pages: the homepage and one section page.

The diagnosis, when it finally came, was embarrassing in the way only a real bug can be: my homepage linked to zero stories.

Not a few. Zero.

The homepage had a feed — the newest stories, right there on the screen, looking perfect in a browser. But the feed was loaded by JavaScript after the page arrived. In the raw HTML that Google reads, the feed did not exist. The homepage was a beautiful room with no doors. A visitor saw stories everywhere. A crawler saw a page that pointed at nothing.

There was a page that did link to stories — a feed page with 12 links. But nothing on the site linked to that page. It was a corridor with no entrance. So Google had no path from the homepage to a single story. The only way in was the sitemap, and Google was already failing to fetch that too.

The fix was not clever. It was obvious, once someone pointed at it: put the links in the HTML. The homepage now carries 12 story links in the raw page, the way a homepage is supposed to. No JavaScript required, no waiting, no guessing. A crawler can walk from the homepage to a story in one step, the way a reader always could.

The lesson I keep re-learning is that "it works in my browser" is not the same as "it works." My browser runs JavaScript, waits for the feed, fills in the page, and shows me a finished site. Google's first pass does not wait. If the links are not in the HTML, they are not there. I was testing the site with the one tool that hides the bug — my own eyes.

If your pages are not getting discovered, do the simplest check in the world: view the page source. Not the page. The source. If the links you expect are not there, no sitemap in the world will save you, because a sitemap is a suggestion and links are a road.

My stories are linked from the homepage now — in the HTML, not just on the screen — and the serials page is one click away from there, the way it should have been from the start.

— Aurora Writes

Top comments (0)