How to stop links from showing the site

Is there a way to put a link in a message or post and NOT have it show the page?

When I put a link to a page that is on my membership site, instead of displaying the link, it shows a message that the user is not logged in - which is confusing.

I’d like to post a link, but not have it show the website itself. And if it’s possible to make that link open into another tab that would be awesome too.

Am I understanding right — you don’t want this:

but this instead:

https://meta.discourse.org/t/use-google-search-by-default/249951

If so you get it for example using this instead of plain url: <https://meta.discourse.org/t/use-google-search-by-default/249951>

3 Likes

Yes! so I just put it in a bracket? Awesome! Do you have a solution for opening it in another tab too?

Internal links you can’t by default, I reckon.

You can try using ```<A href…> tag like this:

<a href="https://meta.discourse.org/t/use-google-search-by-default/249951" target="_blank">link text here</a>

I don’t know if it works but it is easy ti try out :wink:

Just testing

edit: did not work here

External ones follow admin-setting default other external links in new tab.

4 Likes

Thanks, I was wondering if regular html links with the target blank would work … I appreciate the help. If not… it’s not a big deal!

Your link has the target="_blank" attribute in your message and opens in a new tab when left clicking on it, so it works, unless I’m misunderstanding something?

On a side note, if I quote your message, it will transform your link as a standard markdown link and trim the target attribute, removing the new tab opening inside the quote.


edit: oh, you edited your message so mine does make little sense now. But still, a manual link with target="_blank" works, and it’s worth noting that there’s also a per-user setting for external links only:

https://meta.discourse.org/my/preferences/interface

image

1 Like

No you aren’t. But open in the new tab didn’t work at the Hub and I was too lazy to check it on Safari. But when I did right click, aka. long press, from that open command opened to browser as expected. Apple has its own solutions everywhere :wink:

I added closing </a> but it was shortly after I published that answer (and I would like to put thinking emoji here but emojies aren’t here; strange).

1 Like

It’s up to the developer to decide how links are handled in their apps.

In the iOS settings for the DiscourseHub app there’s a toggle to determine if they open in-app or your default browser.

2 Likes

Thank you for the help!

1 Like

That’s true. And yet external links are opened at Safari, even that is disabled. Anything else would be strange.

If you put a space before the link (or any other characters), Discourse will not draw the preview:

How to stop links from showing the site

This applies to internal and external links.

Without the space:

2 Likes

Thank you! I also found that putting the link between < and > works…

Yes it does. I just mentioned the leading space because it’s a bit quicker to type… just space, paste, and go. :smiley:

2 Likes

Hello,

Just another tip for external links :slightly_smiling_face: You can also block the onebox by domain. This is a good solution if you want to block it for the whole domain.

There is a site setting: blocked onebox domains where you can add those domains for which you don’t want the onebox to generate.

For example: I added wikipedia.org to it.

So it won’t generate onebox for Wikipedia links.

2 Likes