Nginx – ssi on nginx, using variables and conditionals

nginxserver-side-includes

I'm using nginx to server up my static pages. To make the menu dynamically change the class="active" on the respective page, I'm trying to use SSI variables. So I have this on the page itself:

<!--#set var="pageOn" value="floorCare" -->

and then a bit further down:

<!--#include virtual="./includes/header.html" -->

Inside the header.html file, I have:

foo: <!--# if expr="(${pageOn} = floorCare" -->class="active"<!--# endif -->

My understanding (from what I've read up on today), is that this should work. Instead, I get:

foo: [an error occurred while processing the
directive]class="active"[an error occurred while processing the
directive]

I know SSI itself is working (as the header/footer is included fine otherwise)

What am I missing?

Best Answer

There's an extra bracket in expr= value.

It should be: expr="${pageOn} = floorCare" or expr="$pageOn = floorCare", parentheses are not an allowed syntax outside of a string.