Drupal is a registered trademark of Dries Buytaert
Protected Pages 3.0.0 Major update available for module protected_pages (3.0.0). Commerce Core 3.3.8 Minor update available for module commerce (3.3.8). Layout Builder Reorder 2.0.1 Minor update available for module layout_builder_reorder (2.0.1). Ban 1.1.0 Minor update available for module ban (1.1.0). Field Formatter Range 2.0.0 Major update available for module field_formatter_range (2.0.0). Field Formatter Range 8.x-1.8 Minor update available for module field_formatter_range (8.x-1.8). UI Patterns (SDC in Drupal UI) 2.0.18 Minor update available for module ui_patterns (2.0.18). Varbase FAQs 9.2.1 Minor update available for module varbase_faqs (9.2.1). Search API Solr 4.3.11 Module search_api_solr updated after 14 months of inactivity (4.3.11). Provus Mega Menu Module provus_mega_menu crossed 1,000 active installs.

Drupal Js Path

1 sites Security covered
View on drupal.org

This module allows developers to easily access Drupal route aliases and internal paths within JavaScript. This avoids the need to manually update URLs in JavaScript files when route configurations change, simplifying AJAX and other URL-dependent functionality.

CONTENTS OF THIS FILE
---------------------

* Introduction
* Installation
* Usage
* Maintainers

INTRODUCTION
------------

This module will help the developers to use the route options in Javascript.
If we are using ajax or any URL related functionalities we are either rendering through
drupalSettings or we are using direct URL. Now if we change the URL we need to update
it in JS files to reflect the updated URL.

Instead if we can use this module it will provide 2 functions to get the alias or the internalPath
of the route provided. So we don't require any additional settings to fetch the URL even
if it is changed.

* For a full description of the module, visit the project page:
https://www.drupal.org/project/drupal_js_path

* To submit bug reports and feature suggestions, or to track changes:
https://www.drupal.org/project/issues/search/drupal_js_path

INSTALLATION
------------

* Install as you would normally install a contributed Drupal module.
See https://www.drupal.org/node/895232 for further information.

* By Using composer, composer require "drupal/drupal_js_path"

USAGE
-----------
Below are the 2 functions which are available to utilize in JS.
Drupal.alias(routeName, routeParams, routeOptions);
Drupal.path(routeName, routeParams, routeOptions);

MAINTAINERS
-----------

Current maintainers:
* Praveen Achanta (praveen3555) - https://www.drupal.org/u/praveen3555

Activity

Total releases
2
First release
Nov 2025
Latest release
5 days ago
Releases (12 mo)
2 ▲ from 0
Maintenance
Active

Releases

Version Type Release date
2.0.0 Stable Jul 12, 2026
1.0.3 Stable Nov 14, 2025