Bug 28080 - Add system preference that allows users to insert HTML in the <head> on all OPAC pages
Summary: Add system preference that allows users to insert HTML in the <head> on all O...
Status: CLOSED INVALID
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Lucas Gass
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-04-02 18:20 UTC by Lucas Gass
Modified: 2022-06-06 20:24 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 28080: Add OPACHTMLHead system preference (4.18 KB, patch)
2021-04-02 18:26 UTC, Lucas Gass
Details | Diff | Splinter Review
Bug 28080: Add OPACHTMLHead system preference (4.23 KB, patch)
2021-04-04 22:12 UTC, David Nind
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Lucas Gass 2021-04-02 18:20:41 UTC
It would be nice if there was a system preference to allow librarinans to insert HTML into the document <head>. Currently there is no way to add custom scripts or meta content, links to Google fonts, etc. 

Many already insert this in the OPACHeader but since that has moved to the News Tool it is less than ideal to do it this way. ( see bug 26942 )
Comment 1 Lucas Gass 2021-04-02 18:26:06 UTC
Created attachment 119142 [details] [review]
Bug 28080: Add OPACHTMLHead system preference

To test:
-Apply patch
-Look for the syspref OPACHTMLHead
-If you insert HTML it should be present inside the <head> on all pages in the OPAC
-An easy way to test is to add something like this: <style>body{ background: red !important } </style>
-All OPAC pages should then have a red background
Comment 2 David Nind 2021-04-04 22:12:02 UTC
Created attachment 119171 [details] [review]
Bug 28080: Add OPACHTMLHead system preference

To test:
-Apply patch
-Look for the syspref OPACHTMLHead
-If you insert HTML it should be present inside the <head> on all pages in the OPAC
-An easy way to test is to add something like this: <style>body{ background: red !important } </style>
-All OPAC pages should then have a red background

Signed-off-by: David Nind <david@davidnind.com>
Comment 3 David Cook 2021-05-05 03:53:54 UTC
Commenting in an attempt to remind myself to QA this as it would be very useful.
Comment 4 Marcel de Rooy 2021-07-09 09:08:40 UTC
(In reply to Lucas Gass from comment #0)
> It would be nice if there was a system preference to allow librarinans to
> insert HTML into the document <head>. Currently there is no way to add
> custom scripts or meta content, links to Google fonts, etc. 
> 
> Many already insert this in the OPACHeader but since that has moved to the
> News Tool it is less than ideal to do it this way. ( see bug 26942 )

We now have this already:
KohaPlugins.get_plugins_opac_head
And: [% KohaPlugins.get_plugins_opac_js %]
And: [% KohaPlugins.get_plugins_intranet_head %]

So it is a discussion item whether we really should have this too.
We miss an intranet counterpart here, that the plugins offer.
And maybe the location of adding the pref content in doc-head-close is questionable? Should we add it at the end, if we would decide so?

Could you raise this on koha-devel ?
Comment 5 Kyle M Hall 2021-07-09 14:14:18 UTC
> We now have this already:
> KohaPlugins.get_plugins_opac_head
> And: [% KohaPlugins.get_plugins_opac_js %]
> And: [% KohaPlugins.get_plugins_intranet_head %]
> 
> So it is a discussion item whether we really should have this too.
> We miss an intranet counterpart here, that the plugins offer.
> And maybe the location of adding the pref content in doc-head-close is
> questionable? Should we add it at the end, if we would decide so?
> 
> Could you raise this on koha-devel ?

I think you are misunderstanding the purpose of this patch. Clearly, we should not have to build a plugin just to import a google font into Koha for some CSS style. That appears to be the purpose of this ehancement; to allow importing js and css into the correct part of Koha's html, the head block.

Does that make sense?
Comment 6 Marcel de Rooy 2021-07-12 08:53:02 UTC
(In reply to Kyle M Hall from comment #5)
> > We now have this already:
> > KohaPlugins.get_plugins_opac_head
> > And: [% KohaPlugins.get_plugins_opac_js %]
> > And: [% KohaPlugins.get_plugins_intranet_head %]
> > 
> > So it is a discussion item whether we really should have this too.
> > We miss an intranet counterpart here, that the plugins offer.
> > And maybe the location of adding the pref content in doc-head-close is
> > questionable? Should we add it at the end, if we would decide so?
> > 
> > Could you raise this on koha-devel ?
> 
> I think you are misunderstanding the purpose of this patch. Clearly, we
> should not have to build a plugin just to import a google font into Koha for
> some CSS style. That appears to be the purpose of this ehancement; to allow
> importing js and css into the correct part of Koha's html, the head block.
> 
> Does that make sense?

Surely, this explanation is helpful :)
In this case I would ask: Couldnt you do the same with OPACUserCSS and @import url() or @font-face and src: url()?
Comment 7 Lucas Gass 2021-07-13 14:32:54 UTC
> Surely, this explanation is helpful :)
> In this case I would ask: Couldnt you do the same with OPACUserCSS and
> @import url() or @font-face and src: url()?

Marcel, we can do that for CSS, yes. I thought maybe it would be beneficial to be able to add other things that belong in the HTML head, link/meta/style/script etc. 

But perhaps the use case is so small that is not worth adding a whole new system preference to Koha. I will go ahead and mark this one as invalid as there are workarounds to my problem.
Comment 8 Marcel de Rooy 2021-07-13 14:42:20 UTC
(In reply to Lucas Gass from comment #7)
> Marcel, we can do that for CSS, yes. I thought maybe it would be beneficial
> to be able to add other things that belong in the HTML head,
> link/meta/style/script etc. 
> 
> But perhaps the use case is so small that is not worth adding a whole new
> system preference to Koha. I will go ahead and mark this one as invalid as
> there are workarounds to my problem.

Fair enough. But no one told you so yet. Stand with the first QA wave, cope with the second :)