Skip to content

Latest commit

 

History

History
33 lines (21 loc) · 1.2 KB

genuine-status-code.md

File metadata and controls

33 lines (21 loc) · 1.2 KB

Return Genuine Status Code

Returning genuine status code is very important for indexing by search engines. Most of the front-end JavaScript frameworks returns the same page to every request with 200 OK status code, mean 404 pages rendered in a browser is returned with 200status to the web crawlers.

To return expected response code — use this HTML comment. This comment can be placed in any part of HTML-page. head or body tag is the best place for it.

Format:

html:

<!-- response:status-code=404 -->

jade:

// response:status-code=404

Use any standard or custom status codes:

  • 201 - <!-- response:status-code=201 -->
  • 401 - <!-- response:status-code=401 -->
  • 403 - <!-- response:status-code=403 -->
  • 500 - <!-- response:status-code=500 -->
  • 514 - <!-- response:status-code=514 --> (non-standard)

Result:

Return Genuine Status Code Screenshot