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.
Anchor to ExamplesExamples
The following examples contain code snippets that either fail or pass this check.
Anchor to ✗ Fail✗ Fail
The following example includes the hardcoded route /search
:
<form action="/search" method="get" role="search">
Anchor to ✓ Pass✓ Pass
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?