We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 17717
    • 433 Posts
    Hi all,

    Somebody has told me that it may improve your page rank to have internal links in full, i.e. http://www.mydomain.com/link1.html

    Currently, my Wayfinder menu displays links as: link1.html

    Thanks
    Lee
      http://www.blend.uk.com | Web Design by Blend
      • 11975
      • 2,542 Posts
      Hi,

      I haven’t tested it but you could try to add the [(site_url)] in your WF chunks

      <a href="[(site_url)][+wf.link+]" ....


      :-)
        Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
        • 17717
        • 433 Posts
        It did work for all links except the homepage, where there is nothing added to the end of the url, so:

        http://www.mydomain.com

        became:

        http://www.mydomain.comhttp://www.mydomain.com

        Ooops... anyway round this?

        Thanks
        Lee
          http://www.blend.uk.com | Web Design by Blend
          • 11975
          • 2,542 Posts
          Unfortunately WF does not support PHx

          Without changing the WF code I don’t think you can achieve it.
          You could post a feature request in the WF thread


          :-)

            Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
            • 17717
            • 433 Posts
            Cheers, not a big issue just thought I’d see if it could be done.

            Thanks.
              http://www.blend.uk.com | Web Design by Blend
              • 11975
              • 2,542 Posts
              As a partial solution you can add around line 388 in wayfinder.inc.php
              this piece of code:

              if($this->_config[’absoluteLink’]){
              $cLink = $tempDocInfo[’link’];
              $tempDocInfo[’link’] = ($cLink != $modx->config[’site_url’]) ? $modx->config[’site_url’] . $cLink : $cLink;
              }


              just after this part


              //Create the link
              if ($this->_config[’useWeblinkUrl’] !== ’FALSE’ && $tempDocInfo[’type’] == ’reference’) {
              if (is_numeric($tempDocInfo[’content’])) {
              $tempDocInfo[’link’] = $modx->makeUrl(intval($tempDocInfo[’content’]));
              } else {
              $tempDocInfo[’link’] = $tempDocInfo[’content’];
              }
              } elseif ($tempDocInfo[’id’] == $modx->config[’site_start’]) {
              $tempDocInfo[’link’] = $modx->config[’site_url’];
              } else {
              $tempDocInfo[’link’] = $modx->makeUrl($tempDocInfo[’id’]);
              }


              but it’s not a perfect one, it doesn’t take care of weblinks
              the site_url will be added to any link which is not equal to site_url.

              :-)

              PS: you ll have to edit the snippet code
              and in the config array

              ’absoluteLink’ => isset($absoluteLink) ? $absoluteLink : FALSE,

              and add to your call &absoluteLink=1
                Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
                • 17717
                • 433 Posts
                Perfect. Thanks for taking the time to make this addition... very cool.

                Thanks
                Lee
                  http://www.blend.uk.com | Web Design by Blend
                  • 11975
                  • 2,542 Posts
                  U’re welcome

                  this one should work better and in any case even if you’re using weblinks

                  <?php// for highlighting only 
                  $resultIds = array();
                  			
                  			//loop through the results
                  			for($i=0;$i<$numResults;$i++)  {
                  $internLink = true;//added this line
                  				$tempDocInfo = $modx->fetchRow($result);
                  				$resultIds[] = $tempDocInfo['id'];
                  				//Create the link
                  				if ($this->_config['useWeblinkUrl'] !== 'FALSE' && $tempDocInfo['type'] == 'reference') {
                  					if (is_numeric($tempDocInfo['content'])) {
                  						$tempDocInfo['link'] = $modx->makeUrl(intval($tempDocInfo['content']));
                  					} else {
                  						$internLink = false;//this one too
                  						$tempDocInfo['link'] = $tempDocInfo['content'];
                  					}
                  				} elseif ($tempDocInfo['id'] == $modx->config['site_start']) {
                  					$tempDocInfo['link'] = $modx->config['site_url'];
                  				} else {
                  					$tempDocInfo['link'] = $modx->makeUrl($tempDocInfo['id']);
                  				}
                  				//and this block
                  				if($this->_config['absoluteLink'] && $internLink){
                  					$cLink = $tempDocInfo['link'];
                  				 	$tempDocInfo['link'] = ($cLink != $modx->config['site_url']) ? $modx->config['site_url'] . $cLink : $cLink;
                  				}
                  				//determine the level, if parent has changed
                  				if ($prevParent !== $tempDocInfo['parent']) {
                  					$level = count($modx->getParentIds($tempDocInfo['id'])) + 1 - $startLevel;
                  				}
                  				//add parent to hasChildren array for later processing
                  				if (($level > 1 || $this->_config['displayStart']) && !in_array($tempDocInfo['parent'],$this->hasChildren)) {
                  					$this->hasChildren[] = $tempDocInfo['parent'];
                  				}
                  				//set the level
                  				$tempDocInfo['level'] = $level;
                  				$prevParent = $tempDocInfo['parent'];
                  				//determine other output options
                  				$useTextField = (empty($tempDocInfo[$this->_config['textOfLinks']])) ? 'pagetitle' : $this->_config['textOfLinks'];
                  				$tempDocInfo['linktext'] = $tempDocInfo[$useTextField];
                  				$tempDocInfo['title'] = $tempDocInfo[$this->_config['titleOfLinks']];
                  				//If tvs were specified keep array flat otherwise array becomes level->parent->doc
                  				if (!empty($this->tvList)) {
                  					$tempResults[] = $tempDocInfo;
                  				} else {
                  					$resourceArray[$tempDocInfo['level']][$tempDocInfo['parent']][] = $tempDocInfo;
                  				}
                  	        }
                  


                  This block is part of the wayfinder.inc.php
                  It starts around line 372 and end just before this comment line
                  //Process the tvs

                  :-)
                    Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
                    • 22303 MODX Staff
                    • 10,725 Posts
                    I believe the latest version of Wayfinder solves this properly by using the $modx->makeUrl($id, ’’, ’’, ’full’); approach, based on a new parameter passed to the snippet call. The full value in the fourth parameter of makeUrl() generates the absolute URL including the scheme and hostname. This is the best way to generate such URLs in your scripts.

                    Edited incorrect function name as reported by Mark
                      • 18397
                      • 3,250 Posts
                      I believe the function is makeUrl in 0.9.5, not getUrl.