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.

    clarkwinkelmann Okay, thank you, I will try that at some point and reply if it seems like that fixes it.

    3 months later

    Version 1.8 released

    • Slight JS update - now compatible with beta 14
    a month later
    a month later
    21 days later

    Thanks @010101!

    I recently launched a partnership with another company and they wanted their links to open in new tabs - which is what I want as well. So this is a great help - thank you!

    Feature ideas:

    • Toggle various attributes in the extension settings (e.g. turn off nofollow)
    • Ability to set domain-specific attributes settings. (e.g. turn off nofollow for a specific external domain)

    I definitely don't need those things - but it does seem like there could be some utility.

    Cheers!

    18 days later

    Feature suggestion, exclude a list of domains from elint OR exclude certain sections (e.g. Header).

    My issue is that links to mydomain.com from forum.mydomain.com are opened in new tabs. From a forum post that might be desirable, but if you are using fof/links and have navigation links in the header to different areas of your main site it will open in a new tab as well which is not a great UX. Having one of these options (probably the latter) would resolve this.

      ctml

      Interesting. Some people say this shouldn't happen. This uses JavaScript's window.location.hostname which is supposed to not care about whether you have a subdomain or not. But, I guess that may be incorrect. Some people may think this is the case, but obviously it's not true.

      Eventually I may find a better solution, and I know you won't love this and others won't either, but this is all I have time for right now... You may update to the latest version (3.2), and you can now manually go into this extension's extend.php file and you will see where you can list domains that you want to exclude. Line 23:

      var excludes = ['domain0.com','www.domain1.com','domain2.com']; // Optionally exclude domains here

      Also, at the very least this lays the ground work for someone who has more time and is more skilled than me to come along, fork this, and make a version with admin settings. They can use the same JavaScript this extension now uses which is able to do all of the following (and just add admin settings and a database table for more easily excluding the domains):

      • Opens most internal links in the same tab (except subdomains)
      • Opens external links in a new tab
      • And with a manual tweak, can prevent certain URLs from opening in a new tab if you'd like

      Have a great weekend everyone! I must TRY to not be on the computer all day today. 😀

      What about removing no-follow in the internal links and indexing some sobdomains as do-follow links?

      Like: I have a blog named blog.webmatrices.com and I want to add do-follow links in this sub-domain/url.

      Also, removing no-follow links from internal links will help to build internal links and increase SEO.

      Thanks for the plugin...

        Bishwas-py Flarum adds no-follow to internal links? I didn’t know that I’ll take a look at some point.

          Bishwas-py

          Latest version is now 3.3. This release ensures that "nofollow" is removed from internal links in posts. However, as mentioned up in this thread, subdomain type links may not be recognized as internal.

          Here's a recap of everything this extension does for those just tuning in:

          • Opens external links in a new tab
          • Opens internal links (minus subdomains) in the same tab
          • In addition to nofollow, adds ugc (user generated content) and noopener to external links
          • Adds class "external-link" to external links which is helpful if you want to add an icon or style external links
          • And now, removes nofollow from internal links (minus subdomains)
          • May or may not improve SEO
          • Very minimal coding
          • Basically a required extension*

          *If you want your links to be boring then this is not a required extension. 😉

            010101 Adds class "external-link" to external
            This one is a very useful work, you've done. Thanks a lot.

            010101 nofollow from internal links
            Thanks for this one too.

            But removing nofollow in subdomains is still missing. The extension would be 100% perfect if was included.

            What you can do is, create a GUI to accept those domain that needed to be nofollow-free.

            A doubt

            Is the extension removing the nofollow via JS or while rendering?

              Bishwas-py But removing nofollow in subdomains is still missing. The extension would be 100% perfect if was included.

              Sorry, I'm not going to work on making it detect subdomains right now. This is a minimal, very simple extension which uses JavaScript to add or remove certain things for links as the page renders.

              Thank you very much for your suggestions. They may be considered in the future. 👍

              11 days later

              Do not use this if you use the latest SEO extension. The SEO extension now includes an external links in a new tab feature.

              I'll still keep this available just in case someone doesn’t use the SEO extension and wants to use this. But, I personally will be going with the SEO extension.

                2 months later

                010101 SEO ext considers every subdomains as internal links, for example:

                on discuss.flarum.org, sub.flarum.org and flarum.org won't open in new tab.

                17 days later


                This extension is ready for the 1.0 stable release of Flarum.

                (But if you use the SEO extension, that extension does this too.)