A variable for the page: is there a possibility to change classes of CSS

Is there a possibility to introduce a variable for the pages to change value of {div} classes?
For example, to appoint {div class=“the value”} for page №1 and {div class=“the another value”} for page №2 and so on and how realize it?

You could use a page variable or file variable
https://gohugo.io/variables/page/ (the unique per page varibles are listed toward the bottom) or

1 Like

Well, as far as I understood, in the page file write the following: rose = “class1” or rose = “class2” and in the particial html write: div class =$.Param “rose” .
But how to make menu button the current page button was painted and the other non-active buttons was not painted - I can’t find the solution.

I suggest to close this topic because the question of the topic was solved.
About active menu may will be another question after studying docs.

Hard to get too specific because I don’t know what you’re ultimately trying to accomplish, but sounds a little like you’re talking about navigation, so I suggest looking at the menu templating, which has a way of creating active states: https://gohugo.io/templates/menu-templates/

1 Like

Hello! Nice idea, but I like to re-invent wheels, such as <li class="{{ if $.Param “Page3” }}li-mn {{end}}sm1"><a class=“but{{ if $.Param “Page3” }}-mn{{end}}” href="{{ .Site.BaseURL }}contacts.html">Contacts</ a></ li> :stuck_out_tongue: