Skip to main content

HardcodedRoutes

Encourages use of the routes object instead of hardcoding URLs. This helps ensure that themes can support multiple languages, as well as any possible changes in URL format.


The following examples contain code snippets that either fail or pass this check.

The following example includes the hardcoded route /search:

<form action="/search" method="get" role="search">

The following example uses the routes object:

<form action="{{ routes.search_url }}" method="get" role="search">

Anchor to Disabling this checkDisabling this check

This check is safe to disable.


Was this page helpful?