<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Dr. Reza Madahzadeh</title>
    <description>The latest articles on DEV Community by Dr. Reza Madahzadeh (@madahzadeh).</description>
    <link>https://dev.to/madahzadeh</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4095136%2Fe46efd05-165b-458e-86ee-218cc3f49937.jpg</url>
      <title>DEV Community: Dr. Reza Madahzadeh</title>
      <link>https://dev.to/madahzadeh</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/madahzadeh"/>
    <language>en</language>
    <item>
      <title>I built a zero-dependency CLI to audit hreflang (international SEO)</title>
      <dc:creator>Dr. Reza Madahzadeh</dc:creator>
      <pubDate>Wed, 26 Aug 2026 06:19:32 +0000</pubDate>
      <link>https://dev.to/madahzadeh/i-built-a-zero-dependency-cli-to-audit-hreflang-international-seo-47bm</link>
      <guid>https://dev.to/madahzadeh/i-built-a-zero-dependency-cli-to-audit-hreflang-international-seo-47bm</guid>
      <description>&lt;p&gt;If your site serves multiple languages, hreflang is where SEO quietly breaks: page A links B, B never links back; someone writes &lt;code&gt;en_US&lt;/code&gt; instead of &lt;code&gt;en-US&lt;/code&gt;; an alternate points at a redirect; the target canonicalizes somewhere else. None of it is visible in the browser — all of it costs you in the SERPs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;hreflang-audit&lt;/strong&gt; is a single-file Node.js 20+ CLI with zero npm dependencies. It crawls your site (or parses your XML sitemap, sitemap-index included), reads &lt;code&gt;&amp;lt;link rel="alternate" hreflang&amp;gt;&lt;/code&gt; elements, HTTP &lt;code&gt;Link:&lt;/code&gt; headers, and &lt;code&gt;xhtml:link&lt;/code&gt; sitemap entries, and runs 11 checks — from invalid ISO codes (with hints like &lt;code&gt;en-UK&lt;/code&gt; → &lt;code&gt;en-GB&lt;/code&gt;) to missing return links and canonical conflicts.&lt;/p&gt;

&lt;p&gt;Every finding comes with a fix hint. Output is a human-readable report, or &lt;code&gt;--json&lt;/code&gt; for machines, with exit codes designed for CI. There's also a composite GitHub Action so you can run it on a weekly schedule and fail the build when hreflang regresses.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it in under a minute (no npm install)
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/madahzadeh/hreflang-audit.git
&lt;span class="nb"&gt;cd &lt;/span&gt;hreflang-audit
npm run demo   &lt;span class="c"&gt;# offline demo with seeded issues&lt;/span&gt;
node hreflang-audit.mjs https://example.com/   &lt;span class="c"&gt;# audit a real site&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What it checks
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Code&lt;/th&gt;
&lt;th&gt;Check&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;E001&lt;/td&gt;
&lt;td&gt;invalid ISO language/script/region codes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;E002&lt;/td&gt;
&lt;td&gt;underscore locales (&lt;code&gt;en_US&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;E003&lt;/td&gt;
&lt;td&gt;relative hreflang URLs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;E004&lt;/td&gt;
&lt;td&gt;missing return links&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;E005&lt;/td&gt;
&lt;td&gt;conflicting entries (same lang, two URLs)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;E006&lt;/td&gt;
&lt;td&gt;broken target URLs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;W101–W105&lt;/td&gt;
&lt;td&gt;missing self-reference / x-default, redirected targets, canonical mismatches, duplicates&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Honest limitations
&lt;/h2&gt;

&lt;p&gt;HTML is parsed with tolerant regexes rather than a full DOM, JavaScript-rendered pages are not executed, and it complements — not replaces — Search Console's reports.&lt;/p&gt;

&lt;p&gt;Repo: &lt;a href="https://github.com/madahzadeh/hreflang-audit" rel="noopener noreferrer"&gt;github.com/madahzadeh/hreflang-audit&lt;/a&gt; — MIT licensed. Feedback and issues welcome; sitemap/HTML mismatch detection is next on my list.&lt;/p&gt;

</description>
      <category>seo</category>
      <category>node</category>
      <category>opensource</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
