oracle / opengrok

OpenGrok is a fast and usable source code search and cross reference engine, written in Java
http://oracle.github.io/opengrok/
Other
4.36k stars 748 forks source link

Allow text to be added to the <HEAD> via an include file. #2071

Closed blu28 closed 4 years ago

blu28 commented 6 years ago

Just as there are other include files, header_include, etc. there should be a way to include a block of text in the HEAD portion of the page to allow CSS in a compliant manner.

tulinkry commented 6 years ago

What is wrong with using header_include for this purpose?

ahornace commented 6 years ago

I believe the problem is that header_include is used only in pageheader.jspf which is only included in <div id="header"> which is in <body> so you cannot add there your own css settings which would override the default ones for the whole page.

vladak commented 6 years ago

It seems this used to be possible in the past (#2062).

vladak commented 6 years ago

Also, anyone feel free to submit pull request for this, the change itself should be simple by using getFileContent() and mimicking what is already being done for header/body/footer includes.

tulinkry commented 6 years ago

I believe the problem is that header_include is used only in pageheader.jspf which is only included in <div id="header"> which is in <body> so you cannot add there your own css settings which would override the default ones for the whole page.

Yes it is included in the <div id="header">, but you can always override the default styles included in the <head> by defining new ones in the <div id="header">. So placing the new styles in the header_include should work although it is not the best-practise way to do it.

ahornace commented 6 years ago

I'm not very skilled in css but here https://www.w3schools.com/html/html_css.asp they mention no use of css in <body>. So I googled a bit, I came across this https://stackoverflow.com/questions/2830296/using-style-tags-in-the-body-with-other-html and this https://softwareengineering.stackexchange.com/questions/224422/will-it-be-a-wrong-idea-to-have-style-in-body where they mention that many browsers support it but it is not valid. They also mention scoped attribute which does not seem to be supported. Therefore, I think it would be more proper to allow css in the <head>.

tulinkry commented 6 years ago

Therefore, I think it would be more proper to allow css in the <head>.

Yes, it would.