> For the complete documentation index, see [llms.txt](https://docs.elentra.org/ejs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.elentra.org/ejs/1.3/guide/plugins/core-plugins/instance-methods/usdgeneratepath.md). Agents can also search and read this documentation through its [MCP server](https://docs.elentra.org/ejs/~gitbook/mcp).

# $generatePath

## Introduction

`$generatePath(string routeName, Object params = {}) : string`

The **$generatePath** instance method makes it possible to [generate](https://docs.elentra.org/ejs/1.3/guide/routing/path-generation.md) the absolute path to any [route](https://docs.elentra.org/ejs/1.3/guide/routing/routes.md) using its name and [parameters](https://docs.elentra.org/ejs/1.3/guide/routing/routes.md#parameters).  Using this method ensures all links are automatically updated whenever a route is changed.

Alternatively, you may use a [view link](https://docs.elentra.org/ejs/1.3/guide/routing/view-links.md) within your component templates to generate routes declaratively.
