- Edited
010101 I am using this simple but amazing extension. https://github.com/flarum/core/blob/master/src/Formatter/Formatter.php#L141 This is what flarum doing, it to add nofollow and ugc attributes over the url's origin
010101 I am using this simple but amazing extension. https://github.com/flarum/core/blob/master/src/Formatter/Formatter.php#L141 This is what flarum doing, it to add nofollow and ugc attributes over the url's origin
010101 how about add "https://href.li/?" to external url?
I often need to hide the HTTP Referer.
Don't know if there are other methods to get anonymous links
robinodds yes, there's the rel="noreferrer"
HTML attribute. Actually, using noopener
would be a better idea (for external links).
That's what Franz's extension does for example: https://github.com/franzliedke/flarum-open-links-in-new-tab
matteocontrini Good idea. I’ll add noopener. Seems like one day the default for target blank will be noopener. At least that’s what some are pushing. Or, nofollow and noopener together.
010101 What are the differences with this?
https://github.com/franzliedke/flarum-open-links-in-new-tab
Gatsu I believe that one you linked to opens ALL links in an external tab. This only opens external links in a new tab. Internal links, such as ones to another post or page within your forum open in the same window. Therefore, users stay on your site when the link is something on your site, but they leave when the link is not part of your site. This also adds "noopener" which is about security. Many may disagree, but in my opinion, this is how links should work naturally in browsers. If link is part of the site, you stay on that site. If not, you get a new tab/window. Many will also say that you should let the user decide. You can right click and open any link in a new tab. I actually 99% agree with that. EXCEPT, believe it or not, there are users out there who may not know or think about right clicking.
danielunited Must have something to do with an embed extension. Normal external links I’ve tested do not look like that.
If you post a normal external link such as, google.com, what happens?
010101 It happens to all external links - including the ones on the menu. It doesn't happen to internal links (which point to other discussions).
It's not related to the embed extension. I know because when I dsiabled elint
these links work fine (with just nofollow ugc
).
Are you able to reply with a list of installed extensions? And do you have any custom JavaScript added?
If you look at external links at my forum, https://www.sitbreathe.be this is not happening.
010101 Sure.
010101 your code is selecting all the links on the page every time a post is rendered, so it adds the attribute many times. jQuery shouldn't really be used with Flarum unless strictly necessary, there's almost always a better way to do it
matteocontrini I see the issue now. Thanks.
No worries 010101, thank you for taking the time to make this extension in the first place, and help the comunity!
If anyone's interested, this extension works well: https://github.com/franzliedke/flarum-open-links-in-new-tab Just note that is it opens ALL links in a new tab, not just external ones.
010101 sorry if I've been rude, I just wanted to point out that the Flarum frontend is better extended by using the frontend API and avoiding jQuery as much as possible, so that issues like this are less likely to happen. It's true however that Flarum's extension development is currently very poorly documented so it's quite hard to understand how to do things properly...
matteocontrini No worries. It’s just a little frustrating because I can customize something like a WordPress site all day long, but Flarum just cannot be customized (besides some basics with CSS) by your average website owner. Still, I’m a fan of Flarum. And, this particular feature I don’t really know if it’s even important or not.
Even if all links (external too) open in the same window, some say that’s best... Let the user use their browser back button. This whole opening certain links in new windows thing is something I go back and forth on repeatedly. Does it really matter? Maybe Flarum core has made the right decision to open ALL links in the same window. The user needs to utilize their browser features. Go back as needed.
All I know is, more and more, I’m finding myself sticking with only core extensions and some fof extensions and that’s about it because too many issues arise when you add too many extensions or try to do something “fancy.”
Using this.$(selector)
instead of $(selector)
will limit the results to children of the current component. This is a jQuery shortcut offered by Flarum. I think this would solve the issue.