Deutsch
JavaScript & frameworks

Hash URLs

HistoricalAlso known as: #!, hashbang

Hash URLs with #!, also called hashbang URLs, are an address form from the early AJAX era in which a JavaScript application stores the current view in the URL fragment, for example example.com/#!/products. The term here means the web address. Searches also return the shebang in Unix scripts, which is a different topic. In SEO the term is historical.

Background

In 2009, Google proposed an AJAX crawling scheme because its systems could not render and understand pages that use JavaScript to show content. Sites that followed it used #! URLs and supported _escaped_fragment_ URLs for crawlers.

What applies today?

On October 14, 2015, Google announced it no longer recommends the proposal. As long as Googlebot is not blocked from crawling JavaScript or CSS files, it can generally render and understand pages like a modern browser. Google recommended progressive enhancement and named the History API pushState() as one option. Sites that supported _escaped_fragment_ stayed indexed, and Google said it would generally crawl, render and index the #! URLs themselves.

The current JavaScript troubleshooting guide says that because the AJAX crawling scheme has been deprecated since 2015, you can’t rely on URL fragments to work with Googlebot. Google recommends the History API for single-page apps. This entry describes Google’s handling only; other search engines are not covered. A practitioner article advises first checking what Google indexes for such a site and whether the content has search value, and then moving important content to conventional URLs.

Example

Code
old:  https://example.com/#!/shoes/sneakers
new:  https://example.com/shoes/sneakers

The new address is set with history.pushState() and should also work when requested directly.

Sources

  1. Deprecating our AJAX crawling scheme – Google Search Central Blog (2015)developers.google.com
  2. Fix Search-related JavaScript problems – Google Search Centraldevelopers.google.com
  3. History: pushState() – MDNdeveloper.mozilla.org
  4. Hashbang URLs and SEO: What You Need to Know – Dave Ashworth (secondary)daveashworth.co

Last updated: