How to disable onebox and perhaps add a custom class to a link?


(Shri) #1

Is there any way in which I can disable onebox-ing of links in posts?

I notice it has been requested here - Disable onebox for specific links but no solution was offered.

Also, I assume if I wanted a specific class inserted into every link (a href class=“whatever”) within a post, I’d have to write a plugin?


(Shri) #5

Ok, commenting out this line seems to be the most reliable hack, to get rid of onebox.

lib/oneboxer.rb - comment out calls to onebox_raw

Done through app.yaml

  after_code:
    - exec:
        cd: $home/lib
        cmd:
          - sed -i -e 's/    onebox_raw/##shri    onebox_raw/g' oneboxer.rb

Seems to survive rebuilds / posts:refresh_oneboxes etc


(Jeff Atwood) #6

Just put a space or any character in front of the link. Oneboxing only works for links on a line by itself.


(Shri) #7

Jeff - Tried that from a suggestion on another post. Works well for inline links but for some reason our users are trained from another forum software to just insert the link on a standalone line and have embedly do the rest.

Pretty much everyone helping test my dev sites ignored that. Not very instinctive.

Apologies in advance if this mucks up someone’s installation. :slight_smile:

A lot of this for me is grepping through the code and figuring out how it works. My ruby skills are limited to commenting out code at the moment. :slight_smile:

This is what I ended up with:

https://newsfora.com/t/onebox-disabled-through-app-sed/19