2e892c47ff9a4682a4f9868e52706f6e46b5b47b
chmalee
  Tue Sep 27 13:22:09 2022 -0700
Make urlLabel setting support variable substitutions to allow for custom labels, useful when '336104' is not in the url, refs #29954

diff --git src/hg/hgc/hgc.c src/hg/hgc/hgc.c
index 215b36a..7fbfb2f 100644
--- src/hg/hgc/hgc.c
+++ src/hg/hgc/hgc.c
@@ -964,40 +964,42 @@
 // replace the $$ and other wildchards with the url given in tdb 
 char *url = getUrlSetting(tdb, urlSetting);
 //char* eUrl = constructUrl(tdb, url, itemName, encode);
 if (url==NULL || isEmpty(url))
     return;
 
 char *eUrl = replaceInUrl(url, itemName, cart, database, seqName, winStart, winEnd, tdb->track, 
                             encode, fields);
 if (eUrl==NULL)
     return;
 
 /* create the url label setting for trackDb from the url
    setting prefix */
 safef(urlLabelSetting, sizeof(urlLabelSetting), "%sLabel", urlSetting);
 char *linkLabel = trackDbSettingOrDefault(tdb, urlLabelSetting, "Outside Link:");
+char *eLinkLabel = replaceInUrl(linkLabel, itemName, cart, database, seqName, winStart, winEnd, tdb->track,
+                            encode, fields);
 
 // if we got no item name from hgTracks or the item name does not appear in the URL
 // there is no need to show the item name at all
 if (isEmpty(itemName) || !stringIn("$$", url))
     {
-    printf("<A TARGET=_blank HREF='%s'>%s</A><BR>",eUrl, linkLabel);
+    printf("<A TARGET=_blank HREF='%s'>%s</A><BR>",eUrl, eLinkLabel);
     return;
     }
 
-printf("<B>%s </B>",linkLabel);
+printf("<B>%s </B>",eLinkLabel);
 
 printf("<A HREF=\"%s\" target=_blank>", eUrl);
 
 if (sameWord(tdb->table, "npredGene"))
     {
     printf("%s (%s)</A><BR>\n", itemName, "NCBI MapView");
     }
 else
     {
     char *label = itemName;
     if (isNotEmpty(itemLabel) && differentString(itemName, itemLabel))
         label = itemLabel;
     printf("%s</A><BR>\n", label);
     }
 //freeMem(&eUrl); small memory leak