Where is title or app name for sails.js (using node.js and express.js)?

前端 未结 4 1288
无人共我
无人共我 2020-12-31 20:33

I\'m trying to change my websites name. Can\'t find where I can set title or app name.

相关标签:
4条回答
  • 2020-12-31 21:13

    You can create any file in config/ directory, for example config/app.js which contains comething like this:

    module.exports = {
        appName : 'My App'
    };
    

    Any property of exported object become an option of Sails` config.

    appName property is used as application title. For example, in default layout:

    <title><%- title %></title>
    

    where title === sails.config.appName === 'My App'

    By default appName config variable is set to 'Sails'.

    0 讨论(0)
  • 2020-12-31 21:16

    To customise your app's name simply add the following to the module.exports = { … } block in the file config/local.js

    appName : 'My Brilliant App',
    

    You can also override the page's title within your controller by passing in your own title value to the view renderer.

    res.view({title: 'My brilliant title'});
    

    and, to be SEO friendly, in your jade template specify

    head
      title= sails.config.appName + " | " + title
    
    0 讨论(0)
  • 2020-12-31 21:27

    I've got a good answer at the sails github issues#768.

    Adding app name at the app.js and bootstrap.js file works fine for me.

    0 讨论(0)
  • 2020-12-31 21:40

    As of Sails 1.2.2, you may change the app name in \views\layouts\layout.ejs on line 4: <title>Your App Name</title>.

    0 讨论(0)
提交回复
热议问题