htmlAttributes

Type: object | (pageContext) => object
Kind: global.
Environment: server.
Implemented by: vike-react/vike-vue/vike-solid.

You need vike-react/vike-vue/vike-solid to be able to use this setting.

The htmlAttributes setting adds attributes to the <html> tag.

// pages/+config.js
 
export default {
  // <html class="dark">
  htmlAttributes: { class: 'dark' }
}

See lang if you merely want to set the <html lang> attribute.

Global

This setting is global: its value always applies to all your pages. In other words, it doesn't support config inheritance.

You cannot set it at pages/some-page/+config.js: you have to set it at pages/+config.js (or some other global location) instead.

If you want to set different values for different pages, then consider creating a custom setting as shown at Guides > <head> meta tags > Custom settings.

See also