Plainwork

Plainwork / Polyglot for Ghost / Ghost hreflang checker (paste HTML)

Ghost hreflang checker

Paste the <head> of two or more language versions of a page and this checks the hreflang set the way Google reads it: each version lists itself and all the others, links back, uses valid codes and absolute URLs, and has an x-default. It works for any site, and it was written for multilingual Ghost, where a theme has to print these tags by hand. It runs in your browser and fetches nothing, so it also works on a staging site or a draft.

How to get the head of a page

  1. Open the page in your browser, press Ctrl+U (Cmd+Option+U on a Mac) to view the source, and copy everything from <html> down to </head>. Pasting the whole page also works.
  2. Repeat for the same article in each language, for example /small-ferries/ and /es/ferris-pequenos/.
  3. Type each page's full address in its URL box. The URL is how the checker tells which line in the set is the page itself.

What it checks

  • Self-reference. Every version must list its own URL with its own language code. A trailing-slash difference counts as a mismatch.
  • Return links. If the English page points at the Spanish one, the Spanish page must point back, or Google ignores the pair. This is checked for every page you paste.
  • Codes and URLs. Language codes such as en, pt-BR or x-default; absolute URLs only.
  • x-default, html lang and canonical. A missing x-default, an <html lang> that disagrees with the hreflang, or a canonical URL that differs from the page address is reported as a warning.

The rules come from Google's localized versions documentation. The checker cannot tell whether Google has indexed your pages, and it only compares the pages you paste: addresses you leave out are listed as not checked. To check live pages from the command line, the free ghost-polyglot-routes tool (open source, on GitHub soon) has a verify command.

If it finds problems on Ghost

Ghost does not print hreflang for you. The usual fixes are in the guide Multilingual Ghost on one install. To generate the language paths first, use the routes.yaml generator. The finished theme that prints a verified hreflang set on every page is Polyglot for Ghost.

More from the catalogue

Other small tools

See everything →