Recent news (2017-04-18): glossaries-extra v1.14 released.

# Gallery (glossaries): URLs in Glossary Sample

This example has URLs associated with some entries. Care needs to be taken if the URL contains special characters. For the percent character % the simplest method is to just use \%. The tilde character ~ is more complicated. In this case, I suggest using either \string~ or \glstildechar. Note that \protect~ doesn't work (as shown in the PDF).

The URL for each entry is stored in the user1 field (one of the custom fields). Since none of the predefined glossary styles are suitable, this example defines and uses its own custom style. The style is based on the list style (\setglossarystyle{list}) but it's modified to check if the useri field is set (useri is the internal field name corresponding to the user1 key). The value of the useri field is fetched and stored in a control sequence using \glsletentryfield which is then expanded before being processed by \url (provided by hyperref).

The comment lines below are arara directives. You can remove them if you don't use arara.

% arara: pdflatex
% arara: makeglossaries
% arara: pdflatex
\documentclass{report}

\usepackage[nopostdot,toc]{glossaries}

\makeglossaries

\newglossarystyle{urls}
{% based on list style
\setglossarystyle{list}%
\renewcommand{\glossentry}[2]{%
\item[\glsentryitem{##1}%
\glstarget{##1}{\glossentryname{##1}}]
\glossentrydesc{##1}\glspostdescription\space##2%
\ifglshasfield{useri}{##1}{\glspar
\glsletentryfield{\thisurl}{##1}{useri}%
\expandafter\url\expandafter{\thisurl}}{}}%
}

\newcommand*{\entryurl}[1]{%
\glsdoifexists{#1}%
{%
\glsletentryfield{\thisurl}{#1}{useri}%
\expandafter\url\expandafter{\thisurl}%
}%
}

\begin{document}

\chapter{Sample}

\forglsentries{\thislabel}{\gls{\thislabel}. }

The URL associated with the entry \gls{aenean-url}
is \entryurl{aenean-url}.

\printglossary[style=urls,nopostdot=false,nogroupskip]

\end{document}

I've used \forglsentries just to iterate over all the defined entries for this example. In practice, you would typically just use \gls{label}. For example:
Here is a reference to the term \gls{aenean-url}.

The sample document defines a command (\entryurl) that allows you to reference the URL within the document text.

The entries have all been defined in the file example-glossaries-url.tex, which you should find installed in the same location as the glossaries package (or in a sub-directory called test-entries). The entry definitions look like this:

\newglossaryentry{aenean-url}{name={aenean},
user1={http://uk.tug.org/}}

\newglossaryentry{morbi-url}{name={morbi},
description={quam arcu, malesuada sed, volutpat et, elementum sit
amet, libero},
user1={http://www.ctan.org/}}

\newglossaryentry{duis-url}{name={duis},
description={mattis},
user1={http://www.tug.org/}}


If you don't use arara, you need to run the following commands:

pdflatex urls
makeglossaries urls
pdflatex urls

These commands can be run from a terminal or command prompt or you might be able to run them by clicking on a button in your text editor.

I've used the nopostdot option to remove the terminating full stop that is placed by default after the description. The entries all have a "1" after the description. This is the page number on which the entry was referenced. In this sample document all the entries were referenced on page 1.