Router Functions

Navigates to a page on the site, or opens a link that isn't a page on the site.

Call it in response to something the site visitor does, such as clicking a button. While the page renders on the server, it does nothing.

With type: 'ExternalLink', the method calls window.open(href, target) and resolves true. In the editor, it does nothing and resolves false unless target is '_blank'.

Otherwise, the method navigates to href in the current tab. When href is the page the site visitor is already on, the method stays on the page, updates the query parameters in the page's URL, and resolves false.

The promise rejects when the navigation fails, such as when the new page can't load.

Method Declaration

Copy

Method Parameters

linkRouterLinkRequired

Link to navigate to.


optionsNavigateOptions

Options for the navigation.

Returns

Return Type:Promise<boolean>

Promise that resolves with true when the method went to a different page on the site, or called window.open().

false when the site visitor stays on the current page. That happens when href is the current page, when the site can't route to href, and while the page renders on the server. In the platform worker, while the page renders on the server, it resolves undefined.

Examples

Last updated: 29 October 2026

Did this help?