CloServe A view first web framework in Clojure

Conditional Activiate

Conditional Activiate Example

I treid to add google analytics to this page. But it makes no sense to activite it on everywhere trying closerve-example from github. So I write a snippet to check if the server is the right one:

 [node req page-id lift-instr]
 (if (and (:server-name req) 
          (re-matches #"^.*$" (:server-name req)))
   node "")

And attach this snippet to google analytics script:

<script class="lift:ActiveIfIsMkrrf">

Ok, now if you download from github this example code and try it on your machine, it will not send google analytical script to the browser.

One can use the same method to hide/show login, logout buttons for eg.

Update: we added a google ad link on this site with conditional activiate.