Configures behavior when the user goes back or forward in browser history.
A list of possible CSS selectors to replace when the user goes back or forward in history.
If more than one target is configured, the first selector matching both the current page and server response will be updated.
If nothing is configured, the <body> element will be replaced.
Configures which aspects of history fragment updates can update.
If set to true, Unpoly may change the browser URL, the window title,
meta tags and the <html> element's [lang] attribute.
If set to false, Unpoly will never change any of these.
To only update some aspects, set an array of the aspects Unpoly may update:
| Aspect | Updates |
|---|---|
'location' |
The browser URL and history entries. |
'title' |
The window title. |
'metaTags' |
Meta tags in the <head>. |
'lang' |
The <html> element's [lang] attribute. |
For example, this configuration never changes the browser URL, but still updates the [lang] attribute
when the user switches to another language:
up.history.config.enabled = ['lang']
An empty array has the same effect as false.
Render options can only narrow this setting, never update an aspect that it excludes. An overlay without visible history never updates history, regardless of this setting.
See Turning off history aspects for the consequences of excluding an aspect.
Configures whether history changes update meta tags in addition to the document's title and URL.
An array of CSS selectors matching default meta tags that are updated during history changes.
By default, the following elements are matched:
meta elementslink[rel="alternate"] elementlink[rel="canonical"] elementlink[rel="icon"] elementYou can include additional elements by assigning an [up-meta] attribute
or by pushing their selector into this configuration array.
Only elements in the <head> can be matched. Elements in the <body> are never considered,
even if they match one of the configured selectors.
Tip Your coding agent can search these docs locally with the Unpoly agent skill