↑ ↓ select, Enter open, Esc close

Read the hreflang tags of a page

Adjust the values, the command updates live
user@server
curl -s https://example.com/ | tr '\n' ' ' | grep -oiE '<link[^>]*hreflang[^>]*>'

Shows all <link rel="alternate" hreflang="..."> elements of the page. Worth checking: whether the page references itself, whether an x-default exists and whether all target URLs are absolute. The linked language versions must in turn point back to this page.

Note: hreflang can also be declared in the sitemap or in the HTTP header, in which case the output here stays empty.

Also searched as

  • check hreflang tags
  • show language versions of a page
  • hreflang x-default missing
  • extract alternate links from html

Related one-liners

All in SEO checks

Read first, then run.

The commands on myline.de act directly on servers, files and databases. A wrong path or placeholder can delete data irreversibly or make a server unreachable.

  • All commands are provided without warranty and are not tested on every system.
  • Understand what a command does before running it, and check every placeholder.
  • Make a backup first and, if possible, try it on a test system.
  • You run commands at your own risk. Liability for damages is excluded to the extent permitted by law.