<p>I just figured out how to do this. It was vexing me!</p>

<p>Anyway, Craft is awesome and has provided support for <a href="https://craftcms.com/docs/reference-tags" rel="nofollow noreferrer">Reference Tags</a>.</p>

<p>Write your Markdown like this:</p>

<pre><code>[link text]({entry:20})
</code></pre>

<p>Here's the Twig:</p>

<pre><code>{{ entry.markdown|parseRefs|markdown }}
</code></pre>

<p>Reference Tags support more than just entries, but this was the bit that I needed.</p>

CC BY-SA 3.0
2018-03-13T00:30:44.440Z
Wow! Excellent answer @plaintxt! This works, and I learned something new about Craft. Well done!
Ryan
CC BY-SA 3.0
2018-03-13T13:01:19.270Z
Also, it's pretty cool that you can get all kinds of information about an entry using Reference Tags. I used this yesterday:

[{entry:40:title}]({entry:40})

Which resolves to an <a> tag populated with the entry's title and url.
plaintxt
CC BY-SA 3.0
2018-03-09T21:23:47.193Z
2018-03-13T13:04:26.770Z
2018-03-13T13:04:26.770Z
plaintxt
<p>I want to do something that's perhaps connected to the id so that if the title/slug updates, then I don't have to hunt anything down in entries across the CMS.</p>

<p>Something like this maybe?
<code>[Link to an entry](/section#entry:10725)</code></p>

CC BY-SA 3.0
2017-08-10T04:08:26.617Z
For example, highlight text in a rich text area and link to an entry?
Damon
CC BY-SA 3.0
2017-08-10T23:44:29.673Z
Yeah, how do I get the url like that based on an id?
Ryan
CC BY-SA 3.0
2017-08-11T01:50:19.893Z
I don't think I quite follow. If you highlight text (redactor for example) Craft will convert that for you. Just highlight the text and chose link -> entry Which will look something like this in the markup: `http://mysite.com/#entry:2`

You can change the `#entry:2` title, slug - whatever and everything will still work since Craft is linking to the entry. It doesn't care what you call it.
Damon
CC BY-SA 3.0
2017-08-11T12:24:19.283Z
The field isn't Rich Text; it's just plain text, and the template code uses the `|markdown` filter.  I know how to make a link in markdown `[text](url)` but I'm wondering how to fill in the url dynamically based on id.  `http://mysite.com/#entry:2` doesn't work because it prints exactly that string out as the url.  I want `#entry:2` to convert into the uri for that entry on output.
Ryan
<wysiwyg><link><markdown>
How to link to an entry in a Markdown field in the CMS
# How to link to an entry in a Markdown field in the CMS

(Asked by: username_0 on 2017-08-09)

I want to do something that's perhaps connected to the id so that if the title/slug updates, then I don't have to hunt anything down in entries across the CMS.

Something like this maybe?
`[Link to an entry](/section#entry:10725)`

**Tags:** wysiwyg, link, markdown

> **Comments:**
> **username_1**: For example, highlight text in a rich text area and link to an entry?  
> **username_0**: Yeah, how do I get the url like that based on an id?  
> **username_1**: I don't think I quite follow. If you highlight text (redactor for example) Craft will convert that for you. Just highlight the text and chose link -> entry Which will look something like this in the markup: `http://mysite.com/#entry:2`  You can change the `#entry:2` title, slug - whatever and everything will still work since Craft is linking to the entry. It doesn't care what you call it.  
> **username_0**: The field isn't Rich Text; it's just plain text, and the template code uses the `|markdown` filter.  I know how to make a link in markdown `[text](url)` but I'm wondering how to fill in the url dynamically based on id.  `http://mysite.com/#entry:2` doesn't work because it prints exactly that string out as the url.  I want `#entry:2` to convert into the uri for that entry on output.  

---

## 1 answers

### Answer by username_2 on 2018-03-09. Score: 2 | Accepted answer

I just figured out how to do this. It was vexing me!
Anyway, Craft is awesome and has provided support for Reference Tags.
Write your Markdown like this:
[link text]({entry:20})

Here's the Twig:
{{ entry.markdown|parseRefs|markdown }}

Reference Tags support more than just entries, but this was the bit that I needed.

> **Comments:**
> **username_0**: Wow! Excellent answer @username_2! This works, and I learned something new about Craft. Well done!  
> **username_2**: Also, it's pretty cool that you can get all kinds of information about an entry using Reference Tags. I used this yesterday:  [{entry:40:title}]({entry:40})  Which resolves to an <a> tag populated with the entry's title and url.  

---

