Reputation: 67
I just created a variable for a specific site of mine but I want to append a class entitled "partner-text" if I'm actually on that site. If I'm on a different site then don't append it. How can I do that?
use(function() {
var inPartnerPath = currentPage.getPath().indexOf("partners_Skate_Daily");
// to check if the site is under partners_Skate_Daily folder if yes then it should return true
var isPartner = (inPartnerPath != -1) ? 'true' : 'false';
return {
isPartner: isPartner
};
});
Upvotes: 0
Views: 69
Reputation: 227280
'true'
and 'false'
are strings. You want to use the boolean values true
/false
.
You don't even need the ?:
here, !=
already returns you a boolean.
var isPartner = inPartnerPath != -1;
Upvotes: 2