---
title: "DITA: Keyref links"
date: 2014-12-27
description: "DITA: Keyref links You create a key (a word) in your map and define what the key links to. In your topic, you link to..."
canonical_url: https://idratherbewriting.com/keyref_links/index.html
---

> For AI agents: a documentation index is available at https://idratherbewriting.com/llms.txt. Markdown versions of all pages are available by appending .md to any page URL.

# DITA: Keyref links

> To avoid having to change your links, you can use a technique called key references.

You create a key (a word) in your map and define what the key links to. In your topic, you link to the key. This way, if you need to change the link, you need only change the key's reference in your map file. You don't have to change all the keys in your topics.

First add the key link in your map file like this:

```xml
<topicref href="argument_acme.dita" keys="argument" />
```

Alternatively, you can refer to it like this in the map:

```xml
<keydef href="argument_acme.dita" keys="argument" />
```

Then refer to the key in your topic like this:

```xml
<xref keyref="argument"/>
```

You just use `keyref` instead of `href`.

You can use a keyref anywhere there's an href:

```xml
<link keyref="argument"/>
```

or with images:

```xml
<image keyref="argument"/>
```

If the key isn't defined in the map, it doesn't appear in the output. This makes it better to use for your related links because you won't run into issues of the link being dependent on the file being present.
