Search code examples
pugcase-when

How to put two links in case when of jade?


I use jade, and when I make two links in case when, it can not show right style.

I try to make multi lines, but it is wrong.

case pn >= page_count
    when true: |Next Last
    when false: a(href="/orders/list/#{pn+1}")Next a(href="/orders/list/#{page_count}")Last

Here pn is current page-number, page_count as literal meaning.


Solution

  • Try using the tag interpolation syntax:

    case pn >= page_count
        when true: | Next Last
        when false: | #[a(href="/orders/list/#{pn+1}") Next] #[a(href="/orders/list/#{page_count}") Last]