CSS modifiers for partial in a page

I want to have a custom CSS class in my partial, that is taken from the id given to each page. So far, I came up with this:
{{ with .Param "id" }}<div class="newsletterSignup newsletterSignup--{{ . }}"> {{ end }}

Is this the right way of doing it? If there is no id assigned to the page, will it break?
Thanks in advance.

Welcome to the forums @marhigh.

If a page doesn’t have an id param, then the code within the with block will not run

Thanks @zwbetz ! I just edited my post to show the line I was writing. I think what I am struggling with is on how to write a conditional for it, if it has id print it like so, else print something else. Any tips?

Try

{{ with .Param "id" }}
  <div class="newsletterSignup newsletterSignup--{{ . }}">
{{ else }}
  <!-- something else -->
{{ end }}