• Sorry if I create another post in this little span of time, but these are two totally different topics ^^

    So, my site is structured like this:

    • domain.ltd has a ghost blog
    • forum.domain.ltd has NodeBB

    The problem is that if I activate the Outgoing Links Warning Page, and I put in the navigation the home link as domain.ltd, NodeBB will recognize it as an external page.

    There is some way to change this?


  • Global Moderator Plugin & Theme Dev

    Try adding this to your Custom HTML inside a script tag:

    utils.isInternalURI = function (targetLocation, referenceLocation, relative_path) {
      return targetLocation.host === '' ||
          targetLocation.host === referenceLocation.host && targetLocation.protocol === referenceLocation.protocol &&
          (relative_path.length > 0 ? targetLocation.pathname.indexOf(relative_path) === 0 : true)
        ) || 
        (function () {
          var arr1 = referenceLocation.host.split('.');
          var domain1 = arr1[arr1.length - 2] + '.' + arr1[arr1.length - 1];
          var arr2 = targetLocation.host.split('.');
          var domain2 = arr2[arr2.length - 2] + '.' + arr2[arr2.length - 1];
          return domain1 === domain2;

    This will disable outgoing links page if the outgoing link is of the same domain name.

  • @PitaJ Thanks for the code, but reading it I don't get which array should be used to "compute" domain1 and domain2 you always use arr, but it's never defined 🙂

  • Global Moderator Plugin & Theme Dev

    @Giggiux oops. Sorry. Edited my post, try it now.

  • @PitaJ The function works (returns true), but now instead of going to http://domain.tld, goes on http://forum.domain.tld/http://domain.tld since NodeBB add the / before, and i cannot remove it because if there are links to local pages like /categories the / it's gonna be removed and nothing works 😞

  • Global Moderator Plugin & Theme Dev

    @Giggiux hmm okay let me try something else

Suggested Topics

| |