# Auto-Linkify Words

**URL:** https://meta.discourse.org/t/auto-linkify-words/82193
**Category:** Theme component
**Tags:** official, linkify-words
**Created:** [March 5, 2018, 7:16am UTC](https://meta.discourse.org/t/auto-linkify-words/82193 "2018-03-05T07:16:06Z")
**Posts on this page:** 20
**Page:** 6

<div class="post-metadata">

### Author: ![danekhollas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/danekhollas/32/79637_2.png) [@danekhollas](https://meta.discourse.org/u/danekhollas)
#### Post date: [January 17, 2019, 10:35am UTC](https://meta.discourse.org/t/auto-linkify-words/82193/110 "2019-01-17T10:35:18Z")

</div>

This should already work via regex, try this input:

`/discourse/i,https://discourse.org`

See this part of OP

> [@sam](#):
>
> Regular expressions are by default case sensitive (unlike WORD’s which are case insensitive). However, you can change that by using a standard “i” modfier like this:
> 
> ```plaintext
> /foo/i, https://example.com
> 
> ```

Let me know if I should make that description clearer.

---

<div class="post-metadata">

### Author: ![danekhollas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/danekhollas/32/79637_2.png) [@danekhollas](https://meta.discourse.org/u/danekhollas)
#### Post date: [January 17, 2019, 12:57pm UTC](https://meta.discourse.org/t/auto-linkify-words/82193/111 "2019-01-17T12:57:28Z")

</div>

Whoops, I totally misread what you’re trying to do. Indeed, if you want to have case sensitive words, just make them into regexes i.e. `/Discourse/` , without the `i` modifier. Not sure we need extra site setting if the workaround is so simple?

---

<div class="post-metadata">

### Author: ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)
#### Post date: [January 17, 2019, 3:04pm UTC](https://meta.discourse.org/t/auto-linkify-words/82193/112 "2019-01-17T15:04:14Z")

</div>

A post was split to a new topic: [Re-categorise lot of topics with bulk action](https://meta.discourse.org/t/re-categorise-lot-of-topics-with-bulk-action/106814)

---

<div class="post-metadata">

### Author: ![jrgong](https://avatars.discourse-cdn.com/v4/letter/j/c57346/32.png) [@jrgong](https://meta.discourse.org/u/jrgong)
#### Post date: [March 11, 2019, 4:37am UTC](https://meta.discourse.org/t/auto-linkify-words/82193/113 "2019-03-11T04:37:25Z")

</div>

@sam It has been discussed before here: managing the list via CSV file

I am now managing a large set of linkified terms and links in two locations: The linkify settings + a spreadsheet (as backup). It’s a hassle to maintain the list in those 2 locations and keep it in sync when entering new data.

**Is there any way we gonna see a feature to manage those settings lists via CSV?**

I would love to get an option to simply point to an external CSV URL where the list is pulled from either manually or via cronjob.

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [March 11, 2019, 9:43am UTC](https://meta.discourse.org/t/auto-linkify-words/82193/114 "2019-03-11T09:43:21Z")

</div>

Strongly suggest you put together a budget and ask in #Marketplace for someone to build this for you 😉

---

<div class="post-metadata">

### Author: ![rlb](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rlb/32/133546_2.png) [@rlb](https://meta.discourse.org/u/rlb)
#### Post date: [March 13, 2019, 2:30am UTC](https://meta.discourse.org/t/auto-linkify-words/82193/115 "2019-03-13T02:30:45Z")

</div>

I found a strange bug. When you have 0 linked words (you must delete the default words to see that) you’re Discourse turns white - It’s a blank page and you can’t use it anymore.

I had to use [safe mode](https://meta.discourse.org/t/53504?silent=true) to get things back on track.

---

<div class="post-metadata">

### Author: ![danekhollas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/danekhollas/32/79637_2.png) [@danekhollas](https://meta.discourse.org/u/danekhollas)
#### Post date: [March 13, 2019, 10:38am UTC](https://meta.discourse.org/t/auto-linkify-words/82193/116 "2019-03-13T10:38:00Z")

</div>

This is strange, I think I fixed that bug. Do you have the most up-to-date version?

---

<div class="post-metadata">

### Author: ![rlb](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rlb/32/133546_2.png) [@rlb](https://meta.discourse.org/u/rlb)
#### Post date: [March 13, 2019, 12:50pm UTC](https://meta.discourse.org/t/auto-linkify-words/82193/117 "2019-03-13T12:50:18Z")

</div>

I updated yesterday, I’m on Discourse v2.3.0.beta4 +20. Here is the error:

```
Uncaught TypeError: Cannot read property 'trim' of undefined Url: https://mywebsite.com/assets/ember_jquery-716f4989c2eb49ad65163ffb56185407340c2b195b81b9392b62cde3e992cade.js Line: 1 Column: 42780 Window

TypeError: Cannot read property 'trim' of undefined
    at https://mywebsite.com/theme-javascripts/4eb9aa70ad8aa90b1fd248cd745670ff01215caa.js?__ws=mywebsite.com:29:34
    at Array.forEach (<anonymous>)
    at https://mywebsite.com/theme-javascripts/4eb9aa70ad8aa90b1fd248cd745670ff01215caa.js?__ws=mywebsite.com:19:40
    at z (https://mywebsite.com/assets/application-56d715e16ae5d262d0073be59c0b878f76dd67b1b3dd13c44b737b77e22c7a2e.js:1:398826)
    at Object.initialize (https://mywebsite.com/assets/application-56d715e16ae5d262d0073be59c0b878f76dd67b1b3dd13c44b737b77e22c7a2e.js:1:197880)
    at https://mywebsite.com/assets/ember_jquery-716f4989c2eb49ad65163ffb56185407340c2b195b81b9392b62cde3e992cade.js:1:108617
    at e.each (https://mywebsite.com/assets/ember_jquery-716f4989c2eb49ad65163ffb56185407340c2b195b81b9392b62cde3e992cade.js:2:95418)
    at e.walk (https://mywebsite.com/assets/ember_jquery-716f4989c2eb49ad65163ffb56185407340c2b195b81b9392b62cde3e992cade.js:2:94442)
    at e.each (https://mywebsite.com/assets/ember_jquery-716f4989c2eb49ad65163ffb56185407340c2b195b81b9392b62cde3e992cade.js:2:93789)
    at e.topsort (https://mywebsite.com/assets/ember_jquery-716f4989c2eb49ad65163ffb56185407340c2b195b81b9392b62cde3e992cade.js:2:93835)

```

---

<div class="post-metadata">

### Author: ![danekhollas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/danekhollas/32/79637_2.png) [@danekhollas](https://meta.discourse.org/u/danekhollas)
#### Post date: [March 14, 2019, 12:37am UTC](https://meta.discourse.org/t/auto-linkify-words/82193/118 "2019-03-14T00:37:23Z")

</div>

Okay, thanks for the report, that error is useful. I’ll try to have a look next week.

---

<div class="post-metadata">

### Author: ![azzaazeel](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/azzaazeel/32/134131_2.png) [@azzaazeel](https://meta.discourse.org/u/azzaazeel)
#### Post date: [March 15, 2019, 1:47pm UTC](https://meta.discourse.org/t/auto-linkify-words/82193/119 "2019-03-15T13:47:29Z")

</div>

Can you add the feature that shows only first keyword occurs in the topic. Thank you.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [March 18, 2019, 5:23am UTC](https://meta.discourse.org/t/auto-linkify-words/82193/120 "2019-03-18T05:23:10Z")

</div>

Interesting request, we have theme settings happy for a setting for this to be added

---

<div class="post-metadata">

### Author: ![jrgong](https://avatars.discourse-cdn.com/v4/letter/j/c57346/32.png) [@jrgong](https://meta.discourse.org/u/jrgong)
#### Post date: [March 18, 2019, 8:47am UTC](https://meta.discourse.org/t/auto-linkify-words/82193/121 "2019-03-18T08:47:19Z")

</div>

Or even better: able to configure to linkify a keyword for the first n occurrences in a topic. 🙂

---

<div class="post-metadata">

### Author: ![hellekin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hellekin/32/51636_2.png) [@hellekin](https://meta.discourse.org/u/hellekin)
#### Post date: [March 18, 2019, 11:09am UTC](https://meta.discourse.org/t/auto-linkify-words/82193/122 "2019-03-18T11:09:10Z")

</div>

The problem I see with this is that in long topics, one would lose the link when “arriving late”.

Maybe something like the `<abbr>` HTML tag, where the first occurrence uses a `title` attribute, then the following ones do not need it, and let the browser interpret it.

With linkified words, the first (few) links **in the current view of the current user** would be linkified, then only “titled” – maybe clickable, but not displayed as links to avoid information overflow.

---

<div class="post-metadata">

### Author: ![danekhollas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/danekhollas/32/79637_2.png) [@danekhollas](https://meta.discourse.org/u/danekhollas)
#### Post date: [March 18, 2019, 11:09am UTC](https://meta.discourse.org/t/auto-linkify-words/82193/123 "2019-03-18T11:09:11Z")

</div>

This should now be fixed, thanks again for reporting!

> [@azzaazeel](#):
>
> Can you add the feature that shows only first keyword occurs in the topic. Thank you.

I’ve looked into this and it would be tricky to implement without a major rewrite. The current code works per individual paragraphs. Moreover, it works backwards from the last one to the first, so the code would probably need to do an additional forward pass to remove the extra links. This is further complicated by dynamic loading of posts. Not sure all this is worth it for this feature.

What I can do with a bit of code refactor is to remove the duplicities within an individual paragraph. This seems like a reasonable defualt that perhaps does not even require an extra theme setting.

EDIT: @hellekin heh, you were just a bit faster 😃

> [@hellekin](#):
>
> **in the current view of the current user** would be linkified

Yeah, this would also be tricky to ensure if you land in the middle of a topic.

---

<div class="post-metadata">

### Author: ![rlb](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rlb/32/133546_2.png) [@rlb](https://meta.discourse.org/u/rlb)
#### Post date: [March 18, 2019, 9:46pm UTC](https://meta.discourse.org/t/auto-linkify-words/82193/124 "2019-03-18T21:46:45Z")

</div>

> [@danekhollas](#):
>
> This should not be fixed, thanks again for reporting!

Yes, It’s all good now. Thanks! 👍🏻

---

<div class="post-metadata">

### Author: ![danekhollas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/danekhollas/32/79637_2.png) [@danekhollas](https://meta.discourse.org/u/danekhollas)
#### Post date: [April 10, 2019, 9:21am UTC](https://meta.discourse.org/t/auto-linkify-words/82193/125 "2019-04-10T09:21:54Z")

</div>

> [@danekhollas](#):
>
> What I can do with a bit of code refactor is to remove the duplicities within an individual paragraph. This seems like a reasonable defualt that perhaps does not even require an extra theme setting.

This is now merged. Only the first instance of a word in a paragraph will get autolinked (but if you match words using regexes all instances will be autolinked as before).

It did require a rather large refactor during which I fixed some corner cases, but it is possible I introduced some others so please test carefully after you update to latest. @southpaw I know you use this theme extensively so if you could confirm everything looks OK that would be great!

FYI: @azzaazeel

---

<div class="post-metadata">

### Author: ![southpaw](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/southpaw/32/79352_2.png) [@southpaw](https://meta.discourse.org/u/southpaw)
#### Post date: [April 10, 2019, 1:19pm UTC](https://meta.discourse.org/t/auto-linkify-words/82193/126 "2019-04-10T13:19:56Z")

</div>

Hi @danekhollas,

Everything looks good this morning, and the one-link-per-paragraph limit is an appreciated upgrade. I’ve alerted my power users that there has been an update, and we’ll certainly let you know if we see any new oddness arise.

---

<div class="post-metadata">

### Author: ![sat](https://avatars.discourse-cdn.com/v4/letter/s/22d042/32.png) [@sat](https://meta.discourse.org/u/sat)
#### Post date: [April 20, 2019, 2:59am UTC](https://meta.discourse.org/t/auto-linkify-words/82193/127 "2019-04-20T02:59:21Z")

</div>

Hi @sam, I do see if there are more than one word in a sentence for linkify then it only shows hyperlink for the first word. is this limitation?

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [April 26, 2019, 1:30pm UTC](https://meta.discourse.org/t/auto-linkify-words/82193/128 "2019-04-26T13:30:06Z")

</div>

> [@sat](#):
>
> is this limitation?

It’s a feature. See 2 posts up ⬆

> [@danekhollas](#):
>
> This is now merged. Only the first instance of a word in a paragraph will get autolinked (but if you match words using regexes all instances will be autolinked as before).

And like @danekhollas says, if you want to linkify all occurences, you can use regexes instead.

---

<div class="post-metadata">

### Author: ![sat](https://avatars.discourse-cdn.com/v4/letter/s/22d042/32.png) [@sat](https://meta.discourse.org/u/sat)
#### Post date: [April 26, 2019, 4:14pm UTC](https://meta.discourse.org/t/auto-linkify-words/82193/129 "2019-04-26T16:14:57Z")

</div>

Ok, thank you! got it now

[Previous page](https://meta.discourse.org/t/auto-linkify-words/82193.md?page=5)

[Next page](https://meta.discourse.org/t/auto-linkify-words/82193.md?page=7)
