I am using Sails.js and it comes with ejs-templates. There is a default view called layout.ejs which is always including the body parts from other templates. The title element is defined in the layout.ejs and is therefore always the same. Due to SEO I would like to change the title depending on the view that is included. Is there some way of knowing which view is actually called from Sails, in the .ejs file?
相关问题
- Express + EJS - passing arguments to EJS view
- Sails.js - PATH variable - sails command not recog
- How do I perform this query using sailsjs ORM (wat
- Sails is not injecting the files within the assets
- In sails.js, how to access session variables outsi
相关文章
- Webworker-threads: is it OK to use “require” insid
- How to connect two docker containers through local
- SELECT and UPDATE multiple records in oriento / or
- NPM “ENOENT: no such file or directory error” when
- Adding local script files to EJS views
- How to translate models in Sails.js?
- Calling stored procedure from node js
- How to block special characters in HTML input fiel
Update the
<title>
tag of yourlayout.ejs
to<title><%= title %></title>
and send a
title
value from your controller along with the other data, likeres.view('viewname', { title: 'YourTitle', data: data });
Hope this helps!