mirror of
https://github.com/strapi/strapi.git
synced 2025-08-11 02:07:51 +00:00

As a result of taking a look on PR #1967 I realized there is 819 executable files in this repository. It is obvious this is an error.
1.5 KiB
1.5 KiB
strapi-hook-ejs
This built-in hook allows you to use the EJS template engine with custom options.
Configuration
To configure your hook with custom options, you need to edit your ./config/hooks.json
file in your Strapi app.
{
...
"ejs": {
"enabled": true,
"layout": "layout",
"viewExt": "ejs",
"partial": true,
"cache": false,
"debug": true
}
}
More information in the Koa ejs module https://github.com/koajs/ejs#settings
Usage
Insert code in your controller to render a view.
module.exports = {
home: async (ctx) => {
return ctx.render('home', {
title: 'My app title'
});
}
};
This will render the views/home.ejs
file and you will have access to <%= title %>
data in your ejs file.