How to Customize layout.jelly and login.jelly using Theme Manager in Jenkins?

Title: How to Customize layout.jelly and login.jelly using Theme Manager in Jenkins?


Hey Jenkins Community,

I’m exploring ways to customize the layout of Jenkins, specifically layout.jelly and login.jelly. I’ve heard about the Theme Manager plugin, but I’m not sure how to use it effectively for this purpose.

Here are my questions:

  1. How can I customize layout.jelly using the Theme Manager plugin? I want to modify the overall layout and structure of Jenkins pages. What steps do I need to take to achieve this using the Theme Manager?
  2. Is it possible to customize the login page (login.jelly) with the Theme Manager? I’d like to give the login page a personalized touch. Can I do this using the Theme Manager, or is there another recommended approach?
  3. Are there any alternative methods for customizing Jenkins layout and login page? Besides the Theme Manager plugin, are there any other tools or techniques I should consider for customizing Jenkins UI elements?

I’d appreciate any insights, tips, or recommendations from those who have experience with Jenkins customization. Feel free to share your knowledge or point me in the right direction!

Thanks in advance for your help!

Best regards,
alarreine

There is the Login Theme plugin that allows to change the login
With Customizable Header you can change the header looks

There is no possibility to change the layout, you can try your luck with using Simple Theme plugin and change the css styling but pages are really complex usually and you would also need to ensure that it works with all the plugins.

With Theme Manager you can use Dark Theme, there are other themes than dark theme but those are not really maintained and probably lack some css overrides

with hudson.model.PageDecorator and jenkins.model.SimplePageDecorator using Theme-Manager, I can’t change layout.jelly or login.jelly. I looking a way to change these two templates

You can’t change the layout and structure. The Theme manager is only for changing the coloring.
The only way you can influence something is via css rules.

What specifically you have in mind that you want to change?

I need to hide Jenkins version from layout (not only css) for cyber security reason. The only way I found is to rebuild Jenkins project on our own. Do you see a different way? thanks for you answer.

The jenkins version is also sent in the header in each response, so just removing it in layout and login page is not sufficient. You would also need to remove the jetty version then.
And when you remove this header, then the cli might stop working.
What you do is just security by obfuscation. It will not stop an attacker from finding your out the jenkins version. It could even attract attackers when they see there is a jenkins that tries to hide the version, making them assume you might run an older Jenkins version that has known vulnerabilities.
So best is to stay uptodate with the Jenkins version, then there is no reason to hide the version.

curl -I -k https://myjenkins/
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0HTTP/1.1 403 Forbidden
Date: Mon, 22 Apr 2024 08:39:44 GMT
X-Content-Type-Options: nosniff
Set-Cookie: JSESSIONID.d9670bac=node0cb8dpm70wagjnxbe4wis2tj157291.node0; Path=/; Secure; HttpOnly
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Content-Type: text/html;charset=utf-8
X-Hudson: 1.395
X-Jenkins: 2.440.2
X-Jenkins-Session: a3b691ea
Transfer-Encoding: chunked
Server: Jetty(10.0.20)
1 Like

thanks for your reply.