We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7455
    • 2,204 Posts
    I think thats a great way of handeling weblinks

    I like what you did at point 4 is that a snippet? (if yes I love to have it)
    great thinking on this issue.

    Dimmy
      follow me on twitter: @dimmy01
      • 22303 MODX Staff
      • 10,725 Posts
      Quote from: aNoble at Aug 23, 2005, 12:34 PM

      I had a crazy thought. What if we got rid of weblinks and made them nothing more than regular documents...
      ...

      Going with something like this would have a few advantages...
      1. It shows the power and flexibility of templates and TVs and will hopefully get some people thinking outside the box as to what can be done
      2. It would allow you to add TVs to a weblink (ie target)
      3. It should simplify the core a bit by letting us handle all documents the same way
      4. It would also make it much easier to do customizations like a return to site frame

      What do you think? The idea probobly needs some refining but I think the concept of not hard-coding weblinks has merit.

      I agree this might simplify processing in some cases and making some of the normal document properties available for use in weblinks might add power, but some other ideas regarding weblinks merit some consideration on the need to treat them as separate entities.

      For instance, one of my major issues with weblinks is that when using them, the links on a page appear to be internal to the site rather than directly to the target URL. This can reduce a site’s ranking since links to popular sites and back can really play a crucial role in the SEO game, and changing these to be just like the other Documents might make it more difficult to address this issue. Or consider if we wanted to add additional options for links to set additional attributes (such as rel="external" or rel="category tag" or others). Or use a catalog of links to create other features, such as auto-linking specific words or phrases, link ranking, etc.
        • 1764
        • 680 Posts
        Quote from: OpenGeek at Aug 23, 2005, 12:55 PM


        I agree this might simplify processing in some cases and making some of the normal document properties available for use in weblinks might add power, but some other ideas regarding weblinks merit some consideration on the need to treat them as separate entities.

        For instance, one of my major issues with weblinks is that when using them, the links on a page appear to be internal to the site rather than directly to the target URL. This can reduce a site’s ranking since links to popular sites and back can really play a crucial role in the SEO game, and changing these to be just like the other Documents might make it more difficult to address this issue. Or consider if we wanted to add additional options for links to set additional attributes (such as rel="external" or rel="category tag" or others). Or use a catalog of links to create other features, such as auto-linking specific words or phrases, link ranking, etc.

        These are all very good points Jason and I think a lot of these things would be great to implements in MODx.

        However, I don’t see how having weblink be treated like regular documents would limit your ability to do any of the things you mentioned. Like I said, as things stand now, weblinks are documents with a "reference" tag. We could instead tag it as a weblink via a template or TV and use plugins to do the exact same sort of redirect that we’re doing now. The difference with my solution would be that nothing in hard-wired, and I believe that making them documents would give you more ability to do the sort of things you are talking about, and plugin/module developers could continue to develop more great link ideas in the future without having to rely resort to core modifications.

        If documents, TV, plugin’s etc. aren’t powerful enough to do what you want to do, let’s not hard-code it, let’s make them powerful enough.
          • 25663 MODX Staff
          • 12,272 Posts
          I concur 100% Adam (and others). I’ve been on a less is more kick lately, if you can’t tell... wink
            Ryan Thrash, MODX Co-Founder
            Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
            • 32963
            • 1,732 Posts
            Please remember to log your ideas and suggestions inside the Bug tracker
              xWisdom
              www.xwisdomhtml.com
              The fear of the Lord is the beginning of wisdom:
              MODx Co-Founder - Create and do more with less.
              • 1764
              • 680 Posts
              Quote from: xwisdom at Aug 23, 2005, 02:10 PM

              Please remember to log your ideas and suggestions inside the Bug tracker

              Added. Thanks for reminding me.

              http://modxcms.com/bugs/?do=details&id=53
                • 21301
                • 93 Posts
                Great idea to drop the link type and create templates to do the same. I’ve actually done this a while ago for my site because I needed customizable thumbnails (image TV) along with the links. See below for the template/snippet solution. It’s too simple really grin

                What I like about the links being local is that hitting them gets logged locally. But as menstioned before the SE ranking issue could be a problem. So I’m looking for a module/snippet solution that will log the link locally but shows a SE the real external link. Unfortunately I know too little about the way a SE handles your page. Suggestions anybody?

                Template ’hyperlink’
                [[redirectToContent]]


                Snippet ’redirectToContent’
                // This snippet gets the content value and redirects to the url found there
                
                if(!isset($id)) {
                    $id = $modx->documentIdentifier; //current document
                }
                
                $doc = $modx->getDocument($id);
                $url = $doc['content'];
                $modx->sendRedirect($url);
                  • 7455
                  • 2,204 Posts
                  so how do i set a target? i want the link to open in a new window.
                  now it acts the same as a normal weblink made in mod-x
                    follow me on twitter: @dimmy01
                    • 28042 ☆ A M B ☆
                    • 24,524 Posts
                    There is no way.

                    However, if you create this template:
                    <html>
                    <head>
                    <title>Title Here</title>
                    </head>
                    
                    <body onLoad="document.form1.submit();history.go(-1)">
                    [*content*]
                    </body>
                    </html>


                    and create documents with this content (don’t use Rich Text editor)

                    <form name="form1" method="post" action="[~30~]" target="_blank">
                    </form>


                    or whatever page you want to open in the action argument, and use the above template for the pages, it will do the job.
                      Studying MODX in the desert - http://sottwell.com
                      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                      Join the Slack Community - http://modx.org
                      • 1764
                      • 680 Posts
                      Great tip Susan. You could also adapt it a bit so that you could use the content for your link

                      <html>
                      <head>
                      <title>Title Here</title>
                      </head>
                      
                      <body onLoad="document.form1.submit();history.go(-1)">
                      <form name="form1" method="post" action="[*content*]" target="_blank">
                      </form>
                      </body>
                      </html>
                      


                      Then you can just put your link in the the content of the page, which is what weblinks really do anyway.

                      This could cause problems with pop-up blockers though. The best method would probably be to create a custom link template and have a target TV and then write or hack a menu to automatically recognize links and targets.

                      I’ll probably end up doing this for one of my sites eventually, when I do I’ll make sure to release my code back here.

                      TIP: If you go this route I’d suggest unchecking the Richtext box. Otherwise you might get some weird paragraphs and breaks in your link, which could cause havoc.