- For more detailed documentation see
spiderable-middleware
package repository
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 200
status 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.
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)