Disabling auto-link generation / Caper

Hiya.

I’m using a variant of the Casper theme. I’ve noticed that automatic link generation can be a real pain at times, and would like to disable it altogether if possible. Presumably it is a Javascript thing, as the "a href"s don’t show in the generated page source.

It would be ideal I guess to leave it enabled, but I find that in < code > blocks the links essentially disappear as black-on-black text (because rest of theme), which is not ideal. I’ve tried messing with the CSS, but can’t figure a way to just affect the links in a code block and not the rest of the page.

Soo… any hints for disabling link gen, or CSS hints regarding “just alter < a > in code block” would be greatly appreciated.

Not sure what you’re asking about here. Can you provide an example of what you mean by auto-link generation?

When page loads… black on black for the link.

When selecting some text you can see it…

I did NOT ask nor cause for that link to be created, so something in Ghost? Casper?

The only modifications of import I can think of are in the injection code. The rest are minor tweaks of Casper:

Header:

< script >
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-XXXXXXX-1', 'auto'); ga('send', 'pageview');
< /script >

Footer:

< script src="https://cdn.jsdelivr.net/gh/gmfmi/searchinghost-easy@latest/dist/searchinghost-easy-backpack.js" >< /script >
< script >
$("ul.nav").append('<l i class="nav-search" >< a href="#searchinghost-easy" >< svg style="fill:#fff" width="14px" height="14px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" >< path d="M508.875,493.792L353.089,338.005c32.358-35.927,52.245-83.296,52.245-135.339C405.333,90.917,314.417,0,202.667,0 S0,90.917,0,202.XXXXXX.917,202.667,202.667,202.667c52.043,0,99.411-19.887,135.339-52.245l155.786,155.786 XX.083,2.083,4.813,3.125,7.542,3.XXXcX.729,0,5.458-1.042,7.542-3.125C513.042,504.708,513.XXX,497.958,508.875,493.792z M202.667,384c-99.979,0-181.333-81.344-181.333-181.333S102.XXX.XX.XXX,202.667,21.XXXSXXX102.XXX,XXX,202.667 SXXX.XXX,384,202.667,384z"/ >< /svg >< /a >< /li >');
new SearchinGhostEasy({contentApiKey: '8645186bXXXXXXXXXXf4cdf1f4', apiUrl: 'https://www.map59.com'});
< /script >

(edit: The forum should REALLY not process HTML in posts…)

Is this happening in the editor? Or when you publish? And how are you creating your code blocks?

I wasn’t able to reproduce this on stock Casper, so I imagine it has to do with the variant of Casper you’re using…

Are you able to share a link to the live page where this is happening?

(For sharing HTML on the Forum, you can use a code block → ```html

https://www.map59.com/ubiquiti-udm-running-bgp/. Search “First install boostchicken’s”, next code block. There is no HTML source clues, so assuming some JavaScript. Thanks for looking @RyanF.

Here’s what it looks like for me (on Chrome):

It’s definitely not something in Ghost - here’s the HTML that’s being sent to the browser:

<p>First install boostchicken’s excellent on-boot-script-2.x.</p><pre><code>curl -fsL "https://raw.githubusercontent.com/unifi-utilities/unifios-utilities/HEAD/on-boot-script-2.x/remote_install.sh" | /bin/sh</code></pre><p>Next, create an on-boot script /data/on_boot.d/[...]

It looks like Disqus is doing the autolinking, specifically https://c.disquscdn.com/next/embed/alfie_v4.63f1ab6d6b9d5807dc0c94ef3fe0b851.js which is sourced from https://map59.disqus.com/embed.js

2 Likes

That is absolutely brilliant, @vikaspotluri123. (Waves fist madly at Disqus!!! Yet again…)

1 Like

Disabling in Disqus is trivial, once found.

Go to yoursite.disqus.com /admin/settings/advanced/, and there is a feature called “Affiliate links”. Turn it off, and problem solved. Disqus will then only auto-link in the comments section, and not the rest of the page.