---
title: HardcodedRoutes
description: >-
  This check is aimed at encouraging use of the routes object instead of
  hardcoding URLs.
source_url:
  html: >-
    https://shopify.dev/docs/storefronts/themes/tools/theme-check/checks/hardcoded-routes
  md: >-
    https://shopify.dev/docs/storefronts/themes/tools/theme-check/checks/hardcoded-routes.md
---

# HardcodedRoutes

Encourages use of the [routes object](https://shopify.dev/docs/api/liquid/objects/routes) instead of hardcoding URLs. This helps ensure that themes can support multiple languages, as well as any possible changes in URL format.

***

## Examples

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

### ✗ Fail

The following example includes the hardcoded route `/search`:

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

### ✓ Pass

The following example uses the `routes` object:

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

***

## Disabling this check

This check is safe to [disable](https://shopify.dev/docs/storefronts/themes/tools/theme-check/configuration).

***
