From debf8f804c6bc47777f1a239e6b20f78c847e0b2 Mon Sep 17 00:00:00 2001 From: Timothy Alexis Vass Date: Wed, 16 Sep 2020 08:35:15 +0200 Subject: [PATCH] Bug 26454: Add system preference to set meta description for the OPAC Websites should have a meta description tag that shows in search engine results. The content should also be available to set as a system preference. To test: 1) Look at opac-main source (in the browser) and see that meta name="description" is missing. 2) Apply patch. 3) Run: perl installer/data/mysql/updatedatabase.pl 4) Go to system preferences > OPAC and add a description to OpacMetaDescription. 5) Look at opac-main source and confirm that meta name="description" now has content equal to the text set in the OpacMetaDescription system preference. 6) Sign off. Sponsored by: Lunds University Libraries Signed-off-by: Magnus Enger Works as advertised. Newlines are preserved. Double quote is rendered as ". Nice enhancement! Signed-off-by: Martin Renvoize Signed-off-by: Jonathan Druart --- .../bug_26454-add_OpacMetaDescription_syspref.perl | 7 +++++++ installer/data/mysql/sysprefs.sql | 1 + .../prog/en/modules/admin/preferences/opac.pref | 4 ++++ .../opac-tmpl/bootstrap/en/includes/doc-head-close.inc | 3 +++ 4 files changed, 15 insertions(+) create mode 100755 installer/data/mysql/atomicupdate/bug_26454-add_OpacMetaDescription_syspref.perl diff --git a/installer/data/mysql/atomicupdate/bug_26454-add_OpacMetaDescription_syspref.perl b/installer/data/mysql/atomicupdate/bug_26454-add_OpacMetaDescription_syspref.perl new file mode 100755 index 0000000000..30c43e0d62 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_26454-add_OpacMetaDescription_syspref.perl @@ -0,0 +1,7 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + $dbh->do( "INSERT IGNORE INTO systempreferences (variable, value, options, explanation, type) VALUES ('OpacMetaDescription','','','This description will show in search engine results (160 characters).','Textarea');" ); + + # Always end with this (adjust the bug info) + NewVersion( $DBversion, 26454, "Add system preference to set meta description for the OPAC"); +} diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 1df6a1fb53..d1f39dca2e 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -414,6 +414,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('OpacMaintenance','0','','If ON, enables maintenance warning in OPAC','YesNo'), ('OpacMaintenanceNotice','','','A user-defined block of HTML to appear on screen when OpacMaintenace is enabled','Textarea'), ('OpacMaxItemsToDisplay','50','','Max items to display at the OPAC on a biblio detail','Integer'), +('OpacMetaDescription','','','This description will show in search engine results (160 characters).','Textarea'), ('OpacMoreSearches', '', NULL, 'Add additional elements to the OPAC more searches bar', 'Textarea'), ('OPACMySummaryHTML','','70|10','Enter the HTML that will appear in a column on the \'my summary\' and \'my reading history\' tabs when a user is logged in to the OPAC. Enter {BIBLIONUMBER}, {TITLE}, {AUTHOR}, or {ISBN} in place of their respective variables in the HTML. Leave blank to disable.','Textarea'), ('OPACMySummaryNote','','','Note to display on the patron summary page. This note only appears if the patron is connected.','Free'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref index e078692ff6..1d09da94c7 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref @@ -73,6 +73,10 @@ OPAC: type: textarea syntax: text/html class: code + - + - "This description will show in search engine results (160 characters)." + - pref: OpacMetaDescription + type: textarea - - By default, show bibliographic records - pref: BiblioDefaultView diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/doc-head-close.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/doc-head-close.inc index f3c9d7c817..e0963ca5d3 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/doc-head-close.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/doc-head-close.inc @@ -5,6 +5,9 @@ +[% IF ( Koha.Preference('OpacMetaDescription') ) %] + +[% END %] [% IF ( bidi ) %] [% Asset.css("lib/jquery/jquery-ui-rtl-1.12.1.min.css") | $raw %] -- 2.39.5