> For the complete documentation index, see [llms.txt](https://docs.realmacsoftware.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.realmacsoftware.com/elements/api-reference/components/hooks.js/available-data/rw.page.md).

# rw\.page

The `rw.page` object provides access to information about the current page where the component is placed.

## Properties

| Property               | Type    | Description                                            |
| ---------------------- | ------- | ------------------------------------------------------ |
| `id`                   | String  | Unique identifier for the page (e.g., `"page0"`)       |
| `title`                | String  | The page title                                         |
| `description`          | String  | Page description/meta description                      |
| `filename`             | String  | The page filename (e.g., `"index.html"`)               |
| `ext`                  | String  | File extension (e.g., `"html"`)                        |
| `language`             | String  | Page language code (e.g., `"en"`)                      |
| `absolutePath`         | String  | Full path to the page                                  |
| `docRootPath`          | String  | Path to document root                                  |
| `projectResourcesPath` | String  | Path to project resources folder (e.g., `"resources"`) |
| `isFolder`             | Boolean | Whether this represents a folder                       |
| `displayInMenu`        | Boolean | Whether to show in navigation                          |
| `isDraft`              | Boolean | Draft pages are not published                          |
| `icon`                 | Object  | Page icon object                                       |

## Example Object

```javascript
{
    "id": "page0",
    "title": "About",
    "description": "",
    "filename": "index.html",
    "ext": "html",
    "language": "en",
    "absolutePath": "",
    "docRootPath": "",
    "projectResourcesPath": "resources",
    "isFolder": false,
    "displayInMenu": true,
    "isDraft": false,
    "icon": {}
}
```

## Accessing Page Data

```javascript
const transformHook = (rw) => {
    const { 
        id, 
        title, 
        filename, 
        absolutePath,
        language 
    } = rw.page;
    
    console.log(id);           // "page0"
    console.log(title);        // "About"
    console.log(filename);     // "index.html"
    console.log(absolutePath); // ""
    console.log(language);     // "en"
};

exports.transformHook = transformHook;
```

## Checking Page Status

```javascript
const transformHook = (rw) => {
    const { isFolder, isDraft, displayInMenu } = rw.page;
    
    if (isDraft) {
        console.log("This page is a draft");
    }
    
    if (isFolder) {
        console.log("This is a folder page");
    }
    
    rw.setProps({
        showInNav: displayInMenu && !isDraft
    });
};

exports.transformHook = transformHook;
```

## Using Page Paths

```javascript
const transformHook = (rw) => {
    const { absolutePath, projectResourcesPath } = rw.page;
    
    rw.setProps({
        currentPath: absolutePath,
        resourcesPath: projectResourcesPath
    });
};

exports.transformHook = transformHook;
```

## Passing Page Data to Templates

```javascript
const transformHook = (rw) => {
    rw.setProps({
        page: rw.page
    });
};

exports.transformHook = transformHook;
```

In templates:

```html
<h1>{{page.title}}</h1>
<html lang="{{page.language}}">

@if(page.description)
    <meta name="description" content="{{page.description}}">
@endif
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.realmacsoftware.com/elements/api-reference/components/hooks.js/available-data/rw.page.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
