# Glossary
Builds a glossary page containing definition lists found in articles and
pages.
## Example
If you have an article or page that generates the following:
file `defns.html` titled "My definitions"
```
- My Term
- This is definition for My Term.
- Another Term
- And another definition.
```
This plugin will extract all such definitions and put them inside the
`definitions` variable in the pelican context. It will be seen by all page
templates.
The `definitions` variable will have the following attributes:
+ `title`, the definition title, inside tags,
+ `definition`, the definition, inside tags,
+ `link`, if the tags enclose a tag, it will be stored here, or
None,
+ `source`, the article or page that contains this definition list,
+ `see_also`, containing a list of dicts just like this, made from other
definitions in the same list.
For example, for the above html code, the `definitions` variable would look
like the following:
```
definitions = [dict1, dict2]
dict1.title = "My Term"
dict1.definition = "This is definition for My Term."
dict1.link = 'some-link.html'
dict1.source =
dict1.see_also = [dict2]
dict2.title = "Another Term"
dict2.definition = "And another definition."
dict2.link = None
dict2.source =
dict2.see_also = [dict1]
```
Note the `link` attribute does not necessarily point to `source.url`.
## Usage
Next is an example usage of the `definitions` variable.
```
{% for def in definitions | sort(attribute='title') %}
- {{ def.title }}
-
{{ def.definition }}
Defined in:
{% if def.link %}{% endif %}
{{ def.source.title }}
{% if def.link %}{% endif %}.
{% if def.see_also %}
See also:
{% for also in def.see_also %}
{{ also.title }}
{% endfor%}
{% endif %}
{% endfor %}
```
## Notes
+ The `glossary` plugin supports the use of a `GLOSSARY_EXCLUDE` setting,
which can be set to an arbitrary list in your `pelicanconf.py`. By
default, it's equal to the empty list. `glossary` will add to
`definitions` all definitions **EXCEPT** those whose title is found
inside `GLOSSARY_EXCLUDE`.