Answer the question
In order to leave comments, you need to log in
How to display a block in an express.js template depending on the presence of the locals property?
Good day everyone. There is a site on a node + express js. According to the standard, there is index.js in routes, and there is a template for displaying typical pages.
In the template in head the following construction:
<!DOCTYPE html>
<html class="no-js" lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="<%= locals.meta_description %>">
<title><%= locals.title %></title>
<link rel="canonical" href="https://www.site<%= locals.canonical_link %>">
router.get('/page-1', function (req, res) {
res.render('page-template', {
layout: 'layout',
title: 'Title1',
template: 'page',
canonical_link: '/page-1',
meta_description: 'Descr-1'
});
});
<link rel="canonical" href="https.....>.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question