> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

## Resource: Functions

## Article: Functions

## Article Link: https://dev.wix.com/docs/sdk/site-sdk/pages-and-navigation/url/functions.md

## Article Content:

import { Property, PropertyList, ExpandableSection, RequestResponseExamples } from "@wix/docs-ui/content";

{/* Generated by @wix/tw-typedoc-to-wix-docs from packages/site-service-url/src/definition/index.ts. Do not edit this file directly — edit the TSDoc in the source package. */}

# URL Functions

## appSectionRelativeUrl()

Retrieves the URL of an app page, relative to the site root URL.

Use it to link to a page that an installed app adds to the site, such as the Bookings checkout,
without hardcoding a path that a Wix user can change.

A returned URL doesn't confirm that the app page exists, because:
- When the app has no page with `sectionId` as its app page ID, this method returns the URL of another
  page of the same app.
- This method searches only the pages the host supplies, and the host leaves out popups. So an app
  page that opens as a popup gets the same result as a missing one.

For a router page, the URL is the router prefix followed by the page's own path, such as
`/category/category-page`, not the path of one of the router's items. To link to an item, specify
`true` for `discardRouterPageSuffix` to retrieve only the prefix, then append the item's path from
your own data for the item, such as a category's slug.

Prepend `siteUrl` to build an absolute URL.

### Method Declaration

```ts
appSectionRelativeUrl(appId: string, sectionId: string, discardRouterPageSuffix?: boolean): string | undefined
```

### Method Parameters

<PropertyList bordered>
  <Property name="appId" type="string" required>
    ID of the app that owns the page. This is the app's `appDefinitionId`. Case-sensitive,
    and must match exactly.

    For apps made by Wix, see
    [Apps Created by Wix](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/platform/about-apps-created-by-wix.md).
    For your own app, find it in your app's dashboard.
  </Property>
  <Property name="sectionId" type="string" required>
    App page ID of the page. Case-sensitive, and must match exactly.

    To find it, read the page's `appPageId` in the `pages` map of `@wix/site-service-pages` on a site
    where the app is installed.
  </Property>
  <Property name="discardRouterPageSuffix" type="boolean">
    Whether to return only the router prefix, such as `/category`, instead
    of the prefix followed by the page's own path.

    On a page that isn't a router page, the result is the page's path whichever value you specify.

    Default: `false`
  </Property>
</PropertyList>

### Returns

<PropertyList bordered>
  <Property name="Return Type:" type="string | undefined">
    Relative URL of the page, such as `/booking-checkout`.

    `undefined` when no page on the site belongs to the app. For example, when the app isn't installed.
  </Property>
</PropertyList>

### Examples

<RequestResponseExamples defaultName="appSectionRelativeUrl" requestName="JavaScript" requestType="JavaScript" examples={[
  {
    title: `Link to an app page`,
    content: {
      methodExample: {
        Request: `~~~tsx
import { useService } from '@wix/services-manager-react'
import { UrlDefinition } from '@wix/site-service-url/definition'

function BookNowLink() {
    const urlService = useService(UrlDefinition)
    const relativeUrl = urlService.appSectionRelativeUrl(
        '13d21c63-b5ec-5912-8397-c3a5ddb27a97',
        'book_checkout'
    )

    // No page on this site belongs to Wix Bookings.
    if (!relativeUrl) {
        return null
    }

    return <a href={urlService.siteUrl + relativeUrl}>Book now</a>
}
~~~`
      }
    }
  },
  {
    title: `Link to an item on a router page`,
    content: {
      methodExample: {
        Request: `~~~ts
// urlService is resolved from @wix/site-service-url, as in the first example.
function categoryUrl(categorySlug: string): string | undefined {
    // '/category', without the category page's own path
    const prefix = urlService.appSectionRelativeUrl(
        '1380b703-ce81-ff05-f115-39571d94dfcd',
        'Category Page',
        true
    )

    if (!prefix) {
        return undefined
    }

    // For example, 'https://www.example.com/category/jackets'
    return \`\${urlService.siteUrl}\${prefix}/\${categorySlug}\`
}
~~~`
      }
    }
  }
]} />