Nunjucks Inline Ternary Operator examples:

<span>{{ if else absolutePostUrl }}</span>

it check the is not undefined otherwise return absolutePostUrl


EJS Inline Ternary Operator examples:

You need to replace the <% %> tag with the <%= %> tag in order to output the expression value:

<li class="<%= currentMenu === 'dashboard' ? 'active' : '' %>">
  <!-- -->

As the EJS documentation states, the <% %> tags are for control-flow, no output code; whereas the <%= %> tags output and interpolate the value into the HTML template.

For example, the if statement below uses <% %> tags because the statement doesn’t need to be outputted into the HTML. Then inside of the condition, the variable is outputted and interpolated into the HTML template by using the <%= %> tags: <%= currentMenu %>.

<% if (currentMenu === 'dashboard') { %>
  <span><%= currentMenu %></span>
<% } %>