> For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.

# html.title

- **Type:** `string | Function`
- **Default:** `'Rsbuild App'`

Set the title tag of the HTML page.

:::tip
If the HTML template used in the current project already includes the `<title>` tag, the `html.title` will not take effect.
:::

## String usage

`html.title` can be directly set as a string:

```ts title="rsbuild.config.ts"
export default {
  html: {
    title: 'Example',
  },
};
```

The `title` tag generated in HTML will be:

```html
<title>Example</title>
```

## Function usage

- **Type:**

```ts
type TitleFunction = (context: {
  value: string;
  entryName: string;
}) => string | void | Promise<string | void>;
```

When `html.title` is of type Function, the function receives an object as the argument, and the object's values include:

- `value`: the default title configuration of Rsbuild.
- `entryName`: the name of the current entry.

In the MPA (multi-page application) scenario, you can return different `title` strings based on the entry name, thus generating different `title` tags for each page:

```ts title="rsbuild.config.ts"
export default {
  html: {
    title({ entryName }) {
      const titles = {
        foo: 'Foo Page',
        bar: 'Bar Page',
      };
      return titles[entryName] || 'Other Page';
    },
  },
};
```

## Unset `<title>` tag

When `html.title` is set to an empty string, Rsbuild will not inject the `<title>` tag:

```ts title="rsbuild.config.ts"
export default {
  html: {
    title: '',
  },
};
```

## Version history

| Version | Changes                                           |
| ------- | ------------------------------------------------- |
| v2.0.8  | Added support for async functions in `html.title` |
