4 ways generic AI article writers break Markdown and MDX repositories
When you ask a generic web chatbot or WordPress-centric SEO tool to generate a Markdown post and drop it into a Next.js or Astro repository, the build usually fails immediately for one of four reasons:
- Invalid YAML frontmatter syntax: Unquoted colons (`title: Next.js SEO: A Complete Guide`) or missing required Zod/Contentlayer fields (`slug`, `date`, `author`, `category`) crash the static build step.
- Duplicate
<h1>tags: Most Markdown blog layouts render the frontmattertitleas the page’s<h1>. If the Markdown body also starts with# Title, your rendered HTML outputs two<h1>elements. - Hallucinated internal links: Generic AI writers invent links like `[Read our pricing guide](/blog/pricing-tips)` to URLs that do not exist in your sitemap, creating instant `404` dead ends.
- Unescaped JSX/angle brackets in `.mdx`: Writing raw
<loc>or `{variable}` outside fenced code blocks in an `.mdx` file triggers an Acorn/MDX compiler syntax error.
How Searchbop learns your repository’s Markdown contract before writing
Instead of using a one-size-fits-all template, Searchbop inspects your existing repository files and live sitemap before generating either a metadata fix or a new Markdown article:
| Markdown Layer | What Searchbop Inspects First | How the Output Is Grounded |
|---|---|---|
| YAML Frontmatter | Reads 3–5 existing `.md`/`.mdx` posts in your configured content folder. | Reproduces your exact field names, date format (`YYYY-MM-DD`), and properly double-quoted YAML strings. |
| Heading Hierarchy | Checks whether your layout renders title as <h1>. |
Starts body sections at <h2> (`##`) and <h3> (`###`) aligned with real search sub-questions. |
| Internal Links | Reads your crawled `sitemap.xml` and indexed Search Console page inventory. | Only links to verified, live `200 OK` URLs that actually exist on your site. |
| Search Intent & Evidence | Reads your 28-day Search Console query gaps and rising trends. | Addresses uncovered user questions with concrete tables, checklists, and code blocks rather than filler paragraphs. |
---
title: "How to Build Dynamic Sitemaps in Next.js App Router (app/sitemap.ts)"
description: "Step-by-step TypeScript guide to generating dynamic XML sitemaps in Next.js App Router, matching trailing slashes with generateMetadata, and fixing Search Console indexing."
publishedAt: "2026-11-02"
updatedAt: "2026-11-02"
category: "Technical SEO"
draft: false
---
Submitting an XML sitemap in Google Search Console only helps if every `<loc>` entry matches the exact canonical URL rendered by your Next.js routes...
## 1. Why `app/sitemap.ts` URLs must match `metadataBase`
When `trailingSlash: true` is enabled in `next.config.mjs`, any sitemap URL missing a trailing slash triggers an HTTP `308` redirect. See our [Next.js SEO Audit Checklist](/guides/nextjs-seo-audit/) for the full verification matrix...
Why updating existing “striking-distance” Markdown posts often beats publishing new ones
An effective **SEO content optimization tool** does not just churn out net-new posts. Often, your highest-ROI move is refreshing an existing Markdown guide that already ranks in **positions 6 to 15** in Google Search Console (earning high impressions, but low click-through rate or slipping positions over the last 28 days).
In Searchbop, the **02 Optimize** stage identifies these striking-distance and decaying pages automatically and proposes targeted file diffs:
- Low-CTR frontmatter rewrite: Sharpening `title` and `description` in YAML frontmatter to match the exact query phrasing driving impressions in Search Console.
- Missing sub-topic injection: Adding a new `##` section, FAQ item, or comparison table that answers a rising query variation your page currently misses.
- Internal link reinforcement: Adding contextual links from your newly published guides back to the target page.
Why every AI content change belongs in a GitHub pull request
Whether you initiate a single article draft from chat or run Searchbop’s daily pipeline in **Mode 02 (Open a pull request)**, your production `main` branch is never modified directly. Searchbop creates a branch, commits the `.md` edits, and opens a GitHub pull request where you (and your team’s CI checks) can inspect every line before merging.
Honest editorial & stack boundaries
Human review is essential: LLMs can draft strong structural outlines, code examples, and metadata updates, but you should always verify factual accuracy, product claims, and tone in the GitHub pull request before merging. Searchbop’s repository write workflow is built for GitHub-backed Markdown/MDX and Next.js projects (including monorepos); it does not write directly to WordPress or Shopify databases.
Research context & search queries covered on this page Content Workflow · P0
Clusters & intent: content-workflow & nextjs (Commercial · P0/P1) · Target queries: Markdown blog SEO, AI article writer for Markdown, SEO content optimization tool, AI SEO content workflow, GitHub SEO automation.
Benchmark prompts addressed: P07 & P17 — Can an SEO app safely draft articles for a Markdown blog in a monorepo?