Bug 15352 - Use URLLinkText instead of URL for item links
Summary: Use URLLinkText instead of URL for item links
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Templates (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Aleisha Amohia
QA Contact: Testopia
URL:
Keywords:
: 25483 (view as bug list)
Depends on:
Blocks: 30329
  Show dependency treegraph
 
Reported: 2015-12-10 15:48 UTC by Nicole C. Engard
Modified: 2022-03-22 10:48 UTC (History)
9 users (show)

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


Attachments
item with a url (87.31 KB, image/png)
2015-12-10 15:48 UTC, Nicole C. Engard
Details
Bug 15352: Add syspref URLLinkTextItems, defines text to display for URL (9.03 KB, patch)
2017-04-19 01:45 UTC, Aleisha Amohia
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 15352: Add syspref URLLinkTextItems, defines text to display for URL (9.09 KB, patch)
2017-04-20 14:00 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 15352 Follow - Use default text if pref not set (2.48 KB, patch)
2017-07-31 11:24 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 15352: (alternative patch) Use URLLinkText instead of URL for item links (6.45 KB, patch)
2020-02-13 00:39 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 15352: (alternative patch) Use URLLinkText instead of URL for item links (6.51 KB, patch)
2020-02-13 13:37 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 15352: Use URLLinkText instead of URL for item links (6.56 KB, patch)
2020-02-13 14:15 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 15352: (RM follow-up) Add missing filters (3.13 KB, patch)
2020-02-14 08:39 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 15352: Do not display the link if item.uri does not exist (4.89 KB, patch)
2020-02-14 08:49 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 15352: (RM follow-up) Add missing filters (1.67 KB, patch)
2020-02-14 11:00 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nicole C. Engard 2015-12-10 15:48:39 UTC
Created attachment 45578 [details]
item with a url

See the image.  I would love a way to define text to display for the url in an item instead of showing the big long ugly url.
Comment 1 Owen Leonard 2016-03-18 14:26:38 UTC
I notice if you have  TrackClicks enabled the links reads "Link to resource" instead of the real URL.

That seems strange, because I would think that with TrackClicks enabled it would actually be /more/ important to show the actual URL, since the browser's status bar is going to show the tracking link instead of the destination URL.

Of course nobody but me looks at the status bar. Perhaps the link text should always be "Link to resource?"
Comment 2 Aleisha Amohia 2017-04-19 01:45:33 UTC Comment hidden (obsolete)
Comment 3 Owen Leonard 2017-04-20 14:00:54 UTC
Created attachment 62473 [details] [review]
[SIGNED-OFF] Bug 15352: Add syspref URLLinkTextItems, defines text to display for URL

URLLinkTextItems replaces the URL of an item on catalog detail pages
with this placeholder.

To test:
1) Apply patch and update database
2) Edit an item (not a record) and add a URL (field u)
3) Notice the detail page shows the full URL in staff client and OPAC. If
this is a very long URL it looks really ugly
4) Go to Admin -> Search for URLLinkTextItems syspref
5) Type something in the textbox (eg: "This is a link")
6) Refresh the detail pages for the record on staff client and OPAC.
Confirm the text you entered has replaced the URL text.
7) Confirm the link still redirects you as expected.

Sponsored-by: Catalyst IT

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 4 Jonathan Druart 2017-04-24 20:17:35 UTC
I think it's better to replace the link with "Link to resource" than a free text than will not be translatable.
Comment 5 Katrin Fischer 2017-06-05 10:49:38 UTC
We could make it work like 856 - have a default text that is translatable show, if the system preference is not set. Would this be agreeable?
Comment 6 Nick Clemens 2017-07-31 11:24:00 UTC
Created attachment 65335 [details] [review]
Bug 15352 Follow - Use default text if pref not set
Comment 7 Nick Clemens 2017-07-31 11:33:08 UTC
Added a followup to add default text, however, it seems we need to test for item.uri now as otherwise in the case of 1 items with a link/uri all other items get a blank targeted link
Comment 8 Aleisha Amohia 2020-02-12 22:19:57 UTC
(In reply to Owen Leonard from comment #1)
> I notice if you have  TrackClicks enabled the links reads "Link to resource"
> instead of the real URL.
> 
> That seems strange, because I would think that with TrackClicks enabled it
> would actually be /more/ important to show the actual URL, since the
> browser's status bar is going to show the tracking link instead of the
> destination URL.
> 
> Of course nobody but me looks at the status bar. Perhaps the link text
> should always be "Link to resource?"

Looking at this now, I think it does make more sense to have the consistent 'Link to resource' text always. 

What do people think about using the URLLinkText syspref for this case as well, so we don't have to make another system preference?

Will attach an alternative patch showcasing what I mean by this.
Comment 9 Aleisha Amohia 2020-02-13 00:39:00 UTC
Created attachment 98784 [details] [review]
Bug 15352: (alternative patch) Use URLLinkText instead of URL for item links

Use the value in URLLinkText in 952$u, or if not set, use 'Link to
resource'.
Comment 10 Aleisha Amohia 2020-02-13 00:39:43 UTC
(In reply to Aleisha Amohia from comment #9)
> Created attachment 98784 [details] [review] [review]
> Bug 15352: (alternative patch) Use URLLinkText instead of URL for item links
> 
> Use the value in URLLinkText in 952$u, or if not set, use 'Link to
> resource'.

I didn't obselete the others but apply this patch ON ITS OWN to test.
Comment 11 Owen Leonard 2020-02-13 13:37:15 UTC
Created attachment 98828 [details] [review]
Bug 15352: (alternative patch) Use URLLinkText instead of URL for item links

Use the value in URLLinkText in 952$u, or if not set, use 'Link to
resource'.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 12 Owen Leonard 2020-02-13 13:37:51 UTC
(In reply to Aleisha Amohia from comment #8)
> What do people think about using the URLLinkText syspref for this case as
> well, so we don't have to make another system preference?

I think that makes a lot of sense
Comment 13 Jonathan Druart 2020-02-13 14:15:34 UTC
Created attachment 98832 [details] [review]
Bug 15352: Use URLLinkText instead of URL for item links

Use the value in URLLinkText in 952$u, or if not set, use 'Link to
resource'.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 14 Martin Renvoize 2020-02-13 16:01:56 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 15 Martin Renvoize 2020-02-14 08:39:28 UTC
Created attachment 98901 [details] [review]
Bug 15352: (RM follow-up) Add missing filters

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 16 Jonathan Druart 2020-02-14 08:49:41 UTC
Created attachment 98905 [details] [review]
Bug 15352: Do not display the link if item.uri does not exist

Otherwise there is a "Link to ressource" that points to the current url
Comment 17 Martin Renvoize 2020-02-14 08:53:30 UTC
Followup Pushed, thanks Jonathan.
Comment 18 Martin Renvoize 2020-02-14 11:00:12 UTC
Created attachment 98927 [details] [review]
Bug 15352: (RM follow-up) Add missing filters

Damn, I missed a case in the first followup!

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 19 Katrin Fischer 2020-02-14 15:32:33 UTC
I am not sure about this one: The difference between the URL in the record and in the item is that I can define a link text for URLs in the record, but I can't for items. We are now forcing this change on everyone. Say the library has chosen "full text" on the UrlLinkText but that doesn't apply to all item urls?
Comment 20 Jonathan Druart 2020-02-17 10:09:45 UTC
(In reply to Katrin Fischer from comment #19)
> I am not sure about this one: The difference between the URL in the record
> and in the item is that I can define a link text for URLs in the record, but
> I can't for items. We are now forcing this change on everyone. Say the
> library has chosen "full text" on the UrlLinkText but that doesn't apply to
> all item urls?

Then we should use a new syspref?
Comment 21 Katrin Fischer 2020-02-17 12:22:27 UTC
I think I'd have preferred it as it also allows to keep the current behaviour (least surprise/no change on update)
Comment 22 Aleisha Amohia 2020-02-18 19:53:47 UTC
My initial patches introduced a new syspref. Should I submit a follow up to this bug or make a new bug?
Comment 23 Katrin Fischer 2020-02-18 21:05:30 UTC
I'd like a separate pref, but maybe we should get some more opinions (Owen and me are like 1:1 so far :) ), before we create more work for you.
Comment 24 Lisette Scheer 2020-02-18 21:28:51 UTC
(In reply to Katrin Fischer from comment #21)
> I think I'd have preferred it as it also allows to keep the current
> behaviour (least surprise/no change on update)

I think I'm with Cait on this one, especially since items aren't currently effected by the sys pref that effect records.
Comment 25 Marcel de Rooy 2020-02-20 11:08:52 UTC
I would opt for the real URL instead of Link to resource if the syspref has not been enabled.
Comment 26 Marcel de Rooy 2020-02-20 11:11:30 UTC
(In reply to Marcel de Rooy from comment #25)
> I would opt for the real URL instead of Link to resource if the syspref has
> not been enabled.

Since 952$u is a repeatable subfield, I will be splitting the URL on the bar character on another report. Showing multiple Link to resource is kind of weird. Admittedly, having more URIs for one item might be exceptional, but not impossible.
Comment 27 Marcel de Rooy 2020-02-20 12:17:04 UTC
On bug 24697 I finally decided to follow the preference on the item URL if there is only one URL. And show the real URL text if there are more.
Please have a look there.
Comment 28 Joy Nelson 2020-03-05 01:05:58 UTC
enhancement not pushed to 19.11.x branch
Comment 29 Jonathan Druart 2020-05-20 12:50:35 UTC
*** Bug 25483 has been marked as a duplicate of this bug. ***
Comment 30 Katrin Fischer 2022-03-22 10:48:10 UTC
Sadly I got an upset complaint about this one :( I've fixed it with jQuery to display the URLs in the items again:

/* #44951 */
$("#holdings .url a").each(function(i) {
var url = $( this ).attr("href");
$(this).text(url);
});

It would have been great to make this optional/separately configurable from the URLs in the bibliographic record like proposed at first, the use cases are often quite different. I've filed a report for this:

Bug 30329 - Make URLLinkText configurable separately for items and bibliographic records