# Reference Link Aliasing or Nesting

**URL:** <https://talk.commonmark.org/t/reference-link-aliasing-or-nesting/3308>\
**Category:** Spec\
**Created:** [December 18, 2019, 5:25pm UTC](https://talk.commonmark.org/t/reference-link-aliasing-or-nesting/3308 "2019-12-18T17:25:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Crissov](https://cdn.commonmark.org/user_avatar/talk.commonmark.org/crissov/32/1455_2.png) [@Crissov](https://talk.commonmark.org/u/Crissov)\
**Post date:** [December 18, 2019, 5:25pm UTC](https://talk.commonmark.org/t/reference-link-aliasing-or-nesting/3308/1 "2019-12-18T17:25:25Z")

</div>

It has been suggested before to turn incomplete Link Reference Definitions into something more useful:

> [@Turning empty link definitions into anchors](https://talk.commonmark.org/t/turning-empty-link-definitions-into-anchors/893):
>
> Currently CommonMark doesn’t allow reference link definitions without a target: [foo]: [foo] In this respect it is [in line with most implementations](http://johnmacfarlane.net/babelmark2/?normalize=1&text=%5Bfoo%5D%3A%0A%0A%5Bfoo%5D%0A), though a few treat this as a link with an empty URL. This seems a waste of good syntx. What if an empty reference definition were given a special meaning as an anchor, as illustrated by the following (which would have been really handy in writing the spec document): [link text]: The link text cannot contain links, though it may contain image…

I was wondering whether it would make sense to allow multiple labels for a single link destination (and title), i.e. introduce aliases, e.g. to explicitly and implicitly link to the most recent version of a specification.

```markdown
[cm]: 
[cm29]: https://spec.commonmark.org/0.29/
[cm28]: https://spec.commonmark.org/0.28/

```

or allow reference links within reference link definitions (risking infinite loops):

```markdown
[cm]: [cm29]
[cm28]: https://spec.commonmark.org/0.28/
[cm29]: https://spec.commonmark.org/0.29/

```

The latter would be useful in case the title (or another, extended attribute) should differ, but the URL should stay the same:

```markdown
[foo]: foo.pdf
[bar]: [foo] "see bar section in particular"
[baz]: [foo] "see baz section in particular"

```

With [URL Templates (RFC 6570)](https://tools.ietf.org/html/rfc6570) built-in, this would become really powerful:

```markdown
[foo]: foo.pdf{#label} "see {label} section in particular"
[bar]: [foo] 
[baz]: [foo]

```

## Basic example

```markdown
Reference link aliases
======================

* [foo][]
* [bar][]
* [baz][]
* [quz][]
* [dlr][]

______

[foo]:

[bar]: http://example.org

[foo]:
[baz]: http://example.com

[foo]:[quz]: http://example.edu

[foo]: [dlr]: http://example.mil

[foo]
[sit]: http://example.net

[foo][amt]: http://example.arpa

```

[Dingus](https://spec.commonmark.org/dingus/?text=Reference%20link%20aliases%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D*%20%5Bfoo%5D%5B%5D*%20%5Bbar%5D%5B%5D*%20%5Bbaz%5D%5B%5D*%20%5Bquz%5D%5B%5D*%20%5Bdlr%5D%5B%5D ______ %5Bfoo%5D%3A%5Bbar%5D%3A%20http%3A%2F%2Fexample.org%5Bfoo%5D%3A%5Bbaz%5D%3A%20http%3A%2F%2Fexample.com%5Bfoo%5D%3A%5Bquz%5D%3A%20http%3A%2F%2Fexample.edu%5Bfoo%5D%3A%20%5Bdlr%5D%3A%20http%3A%2F%2Fexample.mil%5Bfoo%5D%5Bsit%5D%3A%20http%3A%2F%2Fexample.net%5Bfoo%5D%5Bamt%5D%3A%20http%3A%2F%2Fexample.arpa)  
[Babelmark3](https://babelmark.github.io/?text=Reference+link+aliases%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D*+%5Bfoo%5D%5B%5D*+%5Bbar%5D%5B%5D*+%5Bbaz%5D%5B%5D*+%5Bquz%5D%5B%5D*+%5Bdlr%5D%5B%5D ______ %5Bfoo%5D%3A%5Bbar%5D%3A+http%3A%2F%2Fexample.org%5Bfoo%5D%3A%5Bbaz%5D%3A+http%3A%2F%2Fexample.com%5Bfoo%5D%3A%5Bquz%5D%3A+http%3A%2F%2Fexample.edu%5Bfoo%5D%3A+%5Bdlr%5D%3A+http%3A%2F%2Fexample.mil%5Bfoo%5D%5Bsit%5D%3A+http%3A%2F%2Fexample.net%5Bfoo%5D%5Bamt%5D%3A+http%3A%2F%2Fexample.arpa)
