You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A layout is simply a Handlebars template with a `{{{body}}}` placeholder. Usually it will be an HTML page wrapper into which views will be rendered.
187
187
188
-
This view engine adds back the concept of "layout", which was removed in Express 3.x. It can be configured with a path to the layouts directory, by default it's set to `"views/layouts/"`.
188
+
This view engine adds back the concept of "layout", which was removed in Express 3.x. It can be configured with a path to the layouts directory, by default it's set to relative to `express settings.view` + `layouts/`
189
189
190
190
There are two ways to set a default layout: configuring the view engine's `defaultLayout` property, or setting [Express locals][]`app.locals.layout`.
**Note:** Setting the app's `"view engine"` setting will make that value the default file extension used for looking up views.
339
339
340
-
#### `layoutsDir="views/layouts/"`
340
+
#### `layoutsDir`
341
+
Default layouts directory is relative to `express settings.view` + `layouts/`
341
342
The string path to the directory where the layout templates reside.
342
343
343
-
**Note:** If you configure Express to look for views in a custom location (e.g., `app.set('views', 'some/path/')`), you will need to reflect that by passing an updated path as the `layoutsDir` property in your configuration.
344
+
**Note:** If you configure Express to look for views in a custom location (e.g., `app.set('views', 'some/path/')`), and if your `partialsDir` is not relative to `express settings.view` + `layouts/`, you will need to reflect that by passing an updated path as the `layoutsDir` property in your configuration.
344
345
345
-
#### `partialsDir="views/partials/"`
346
+
#### `partialsDir`
347
+
Default partials directory is relative to `express settings.view` + `partials/`
346
348
The string path to the directory where the partials templates reside or object with the following properties:
347
349
348
350
*`dir`: The string path to the directory where the partials templates reside.
349
351
*`namespace`: Optional string namespace to prefix the partial names.
350
352
*`templates`: Optional collection (or promise of a collection) of templates in the form: `{filename: template}`.
351
353
352
-
**Note:** If you configure Express to look for views in a custom location (e.g., `app.set('views', 'some/path/')`), you will need to reflect that by passing an updated path as the `partialsDir` property in your configuration.
354
+
**Note:** If you configure Express to look for views in a custom location (e.g., `app.set('views', 'some/path/')`), and if your `partialsDir` is not relative to `express settings.view` + `partials/`, you will need to reflect that by passing an updated path as the `partialsDir` property in your configuration.
353
355
354
356
**Note:** Multiple partials dirs can be used by making `partialsDir` an array of strings, and/or config objects as described above. The namespacing feature is useful if multiple partials dirs are used and their file paths might clash.
0 commit comments