widgetorchardcmsorchardcms-1.10

Layer rule for all pages except two in Orchard CMS


I am trying to create a layer rule in the widgets section that shows a widget on all pages except two (or more). I've tried a number of options, in some cases the rule will exclude one page but not the other, in other cases it does not exclude either.

At first I wasn't sure how the exclude would work, I tried true not url("/page-1") which returned the error "The rule is not valid: Syntax error: Unexpected token in primary expression (Token 'Not' at position 5)", so I switched to not url("/page-1") which works (for excluding just one page).

I tried a number of ways to exclude more than one page without any luck, including these:

not url("/page-1") or not url("/page-2") // not excluded on any pages
not url("/page-1") or (not url("/page-2")) // not excluded on any pages
not url("/page-1") or url("/page-2") // excluded on page-1 only

I found this issue which confirmed that url("/foo") or url("/bar") is how you include two URLs, which would suggest that the first example above is at least close.

Is it possible to show a widget on all pages, with a few specific pages excluded? Also, either way, is there a different method recommended for doing something like this, other than using a widget layer rule?


Solution

  • This works:

    not (url("/page-1") or url("/page-2"))
    

    I'm chalking this one up to being a little out of practice with logical expressions.