# Linking to portions of a post

**URL:** https://meta.discourse.org/t/linking-to-portions-of-a-post/14022
**Category:** Feature
**Created:** [23 במרץ,‏ 2014,‏ 12:23am UTC](https://meta.discourse.org/t/linking-to-portions-of-a-post/14022 "2014-03-23T00:23:16Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![thristhart](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thristhart/32/108470_2.png) [@thristhart](https://meta.discourse.org/u/thristhart)
#### Post date: [23 במרץ,‏ 2014,‏ 12:23am UTC](https://meta.discourse.org/t/linking-to-portions-of-a-post/14022/1 "2014-03-23T00:23:16Z")

</div>

Is there any way to link to a specific subportion of a large post? At first I attempted to specify an HTML name for an element and reference it `[like so](#name)`. However, discourse (rightly) automatically strips name and id attributes from elements. As a side note, I’m not entirely sure that it would work anyway, as clicking anchor links of that style appears to redirect to the homepage.

The reason I would want to do this is that I am somewhat stretching the intended use for discourse by running a [Nomic](http://en.wikipedia.org/wiki/Nomic) game on it. This game features a very long post with many rules with detailed descriptions, which will be edited and expanded as the game progresses. It would be very useful if I were able to insert a link to a specific rule when discussing it, rather than quoting the rule, which can become very cumbersome when discussing the interaction between multiple rules.

---

<div class="post-metadata">

### Author: ![BhaelOchon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bhaelochon/32/191311_2.png) [@BhaelOchon](https://meta.discourse.org/u/BhaelOchon)
#### Post date: [23 במרץ,‏ 2014,‏ 12:38am UTC](https://meta.discourse.org/t/linking-to-portions-of-a-post/14022/2 "2014-03-23T00:38:59Z")

</div>

You could break up the rules into sections and put each section in its own post. Then you can link to a specific post when you need to call out a rule. Since the rules can change, maybe reserve the first 7-10 posts for rules expansion.

---

<div class="post-metadata">

### Author: ![thristhart](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thristhart/32/108470_2.png) [@thristhart](https://meta.discourse.org/u/thristhart)
#### Post date: [23 במרץ,‏ 2014,‏ 12:52am UTC](https://meta.discourse.org/t/linking-to-portions-of-a-post/14022/3 "2014-03-23T00:52:58Z")

</div>

It’s a serviceable solution, although I am somewhat uncomfortable with the enforced number of sections that would cause. Perhaps a separate rules topic would work, but I’d still prefer the named elements solution. I will experiment and report back.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [23 במרץ,‏ 2014,‏ 2:50am UTC](https://meta.discourse.org/t/linking-to-portions-of-a-post/14022/4 "2014-03-23T02:50:13Z")

</div>

I noticed that GitHub automatically adds deep links for each heading in content. That could make sense but it is kind of a rare use case. I suggest doing what @BhaelOchon recommended first.

---

<div class="post-metadata">

### Author: ![thristhart](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thristhart/32/108470_2.png) [@thristhart](https://meta.discourse.org/u/thristhart)
#### Post date: [23 במרץ,‏ 2014,‏ 3:51am UTC](https://meta.discourse.org/t/linking-to-portions-of-a-post/14022/5 "2014-03-23T03:51:23Z")

</div>

I’ve compromised by creating a topic explicitly for holding rules, and making each rule its own reply. There are some nice side effects to that, such as being able to see posts where a rule has been invoked or referenced.

I would love the automatic header deep links, but I understand why that would be a low priority feature. Might make it a plugin myself if it bothers me enough.

---

<div class="post-metadata">

### Author: ![evaryont](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/evaryont/32/122402_2.png) [@evaryont](https://meta.discourse.org/u/evaryont)
#### Post date: [23 במרץ,‏ 2014,‏ 3:52am UTC](https://meta.discourse.org/t/linking-to-portions-of-a-post/14022/6 "2014-03-23T03:52:17Z")

</div>

> [@codinghorror](#):
>
> I noticed that GitHub automatically adds deep links for each heading in content

It’s also doesn’t make sense as what defines a “heading” in Discourse? While Markdown is fully supported (so you could do `# Part 1`) I think it’s such a rare and unlikely to be used feature.

However, adding ids to headers makes a lot of sense if once [wiki posts](https://meta.discourse.org/t/wiki-topic-mini-spec/13966) are supported.

---

<div class="post-metadata">

### Author: ![thristhart](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thristhart/32/108470_2.png) [@thristhart](https://meta.discourse.org/u/thristhart)
#### Post date: [23 במרץ,‏ 2014,‏ 3:55am UTC](https://meta.discourse.org/t/linking-to-portions-of-a-post/14022/7 "2014-03-23T03:55:49Z")

</div>

> [@evaryont](#):
>
> what defines a “heading” in Discourse?

I don’t understand where ambiguity could exist on that subject, headings would be defined as h1-h6 surely?

---

<div class="post-metadata">

### Author: ![lidel](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lidel/32/115991_2.png) [@lidel](https://meta.discourse.org/u/lidel)
#### Post date: [30 באוקטובר,‏ 2015,‏ 10:04am UTC](https://meta.discourse.org/t/linking-to-portions-of-a-post/14022/8 "2015-10-30T10:04:53Z")

</div>

Seems that this is still missing(?)

Idea: perhaps renderer could just assign a slug generated from contents to each header (h1-h6)?

So

```
# this is a title

```

should render as a named anchor:

```
<a name="this-is-a-title"><h1>this is a title</h1></a>

```

one could then link to its location directly:

```
[jump to local anchor](#this-is-a-title)

```

---

<div class="post-metadata">

### Author: ![Tom\_Newsom](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tom_newsom/32/115981_2.png) [@Tom\_Newsom](https://meta.discourse.org/u/Tom_Newsom)
#### Post date: [30 באוקטובר,‏ 2015,‏ 10:44am UTC](https://meta.discourse.org/t/linking-to-portions-of-a-post/14022/9 "2015-10-30T10:44:24Z")

</div>

This functionality is planned for the next release.

> [@Discourse Version 1.5](https://meta.discourse.org/t/discourse-version-1-5/30609/1):
>
> HTML anchor support that works for deep linking to headings in a post

---

<div class="post-metadata">

### Author: ![mholt](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mholt/32/120935_2.png) [@mholt](https://meta.discourse.org/u/mholt)
#### Post date: [3 ביוני,‏ 2016,‏ 12:40pm UTC](https://meta.discourse.org/t/linking-to-portions-of-a-post/14022/10 "2016-06-03T12:40:44Z")

</div>

Came here looking for this. (Sorry to be _that guy_ reviving an old thread.) Did it ever go out with 1.5? Because I can’t find any instance of “deep linking” or “headings” in those release notes. Is there a way to link directly to headings yet?

---

<div class="post-metadata">

### Author: ![Tom\_Newsom](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tom_newsom/32/115981_2.png) [@Tom\_Newsom](https://meta.discourse.org/u/Tom_Newsom)
#### Post date: [3 ביוני,‏ 2016,‏ 4:27pm UTC](https://meta.discourse.org/t/linking-to-portions-of-a-post/14022/11 "2016-06-03T16:27:40Z")

</div>

It’s still listed in the upcoming features for 1.6, which has a planned release date of August. So we can hope to see it some time between now and then.

---

<div class="post-metadata">

### Author: ![Lew\_Grothe](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lew_grothe/32/337776_2.png) [@Lew\_Grothe](https://meta.discourse.org/u/Lew_Grothe)
#### Post date: [9 ביולי,‏ 2018,‏ 5:45pm UTC](https://meta.discourse.org/t/linking-to-portions-of-a-post/14022/12 "2018-07-09T17:45:05Z")

</div>

Looks like this (headings getting id=‘something’ for anchor support) never happened? Is it still on a list somewhere or dropped?

---

<div class="post-metadata">

### Author: ![featheredtoast](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/featheredtoast/32/116994_2.png) [@featheredtoast](https://meta.discourse.org/u/featheredtoast)
#### Post date: [9 ביולי,‏ 2018,‏ 5:50pm UTC](https://meta.discourse.org/t/linking-to-portions-of-a-post/14022/13 "2018-07-09T17:50:49Z")

</div>

Anchors are indeed supported! Check out the howto here: [Linking to a heading within a post or topic](https://meta.discourse.org/t/deep-linking-to-headings-anchors/47552)

---

<div class="post-metadata">

### Author: ![chapoi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/chapoi/32/537252_2.png) [@chapoi](https://meta.discourse.org/u/chapoi)
#### Post date: [4 בדצמבר,‏ 2025,‏ 11:09am UTC](https://meta.discourse.org/t/linking-to-portions-of-a-post/14022/14 "2025-12-04T11:09:30Z")

</div>


