jaumard
jaumard

Reputation: 8292

Sails layout usage

I have two problem with Sails.js layout,

The first one is I want to remove or change the layout for default answer like 403, 404, 500... but I don't find how to do this

My second problem is if I want to use another layout for a entire Controller, is it possible to override layout for all action in Controller or do I have to put it in every res.view({layout : "mylayout"}) ?

EDIT : just find I can change the layout for http error by editing files under api/responses/

Upvotes: 1

Views: 85

Answers (1)

Matan Gubkin
Matan Gubkin

Reputation: 3099

You can edit your http erros layout by going to your /views folder and edit the error files. You can also edit your default layout by going to /views and edit layout.ejs.

If you want to specify a diffrent layout files a specific file you can edit the file's route like so:

'get /privacy': {
    view: 'users/privacy',
    locals: {
        layout: 'users'
    }
},

for the error files, they dont use a layout so you can just edit them the way you want them to be.

Upvotes: 1

Related Questions