Linkify words in post

theme-component

(Daniel Hollas) #110

This should already work via regex, try this input:

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

See this part of OP

Let me know if I should make that description clearer.


(Daniel Hollas) #111

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?


(Joffrey Jaffeux) split this topic #112

A post was split to a new topic: Re-categorise lot of topics with bulk action


(jrgong) #113

@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.


(Régis Hanol) #114

Strongly suggest you put together a budget and ask in #marketplace for someone to build this for you :wink:


#115

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 to get things back on track.


(Daniel Hollas) #116

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


#117

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)

(Daniel Hollas) #118

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


(Azzaazeel) #119

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


(Sam Saffron) #120

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


(jrgong) #121

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


#122

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.


(Daniel Hollas) #123

This should now be fixed, thanks again for reporting!

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 :smiley:

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


#124

Yes, It’s all good now. Thanks! :+1:t2: