Skip to content

Commit 4c5f95a

Browse files
committed
docs: add reference examples to translatePath
1 parent 2e8d778 commit 4c5f95a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/next-drupal/src/next-drupal.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -908,9 +908,15 @@ export class NextDrupal extends NextDrupalBase {
908908
/**
909909
* Translates a path to a DrupalTranslatedPath object.
910910
*
911-
* @param {string} path The path to translate.
911+
* @param {string} path The resource path. Example: `/blog/slug-for-article`.
912912
* @param {JsonApiWithAuthOption & JsonApiWithNextFetchOptions} options Options for the request.
913913
* @returns {Promise<DrupalTranslatedPath | null>} The translated path.
914+
* @requires Decoupled Router module
915+
* @example
916+
* Get info about a `/blog/slug-for-article` path
917+
* ```ts
918+
* const path = await drupal.translatePath("/blog/slug-for-article")
919+
* ```
914920
*/
915921
async translatePath(
916922
path: string,

0 commit comments

Comments
 (0)