Creating Links
Links are how visitors get from one page to another. You'll probably put a lot of links in menus – a menu being just a list of links to other content. But you may also place links directly inside content text, or inside a block's text.
You may want links that point to a specific content item on your site, or a specific page on an outside web sites. Or you may want powerful links that pick up and return a list of multiple content items from your site's database.
There's a lot you can do. Here's a basic guide to linking:
Placing Links
Know the path
A link is a pointer to another page or node address. The first thing you need to know is the target page's address: its path (or if it's external, such as a page on another website, its URL). If you haven't done so, see Content Paths and URLs.
You're now armed with the paths you need for the links you'll create. Next:
Linking to a path or external URL
Putting a link into a menu item
Every menu item needs to specify a path; sending the visitor to that path is the purpose of a menu item. When creating or editing a menu item, you input the path into the 'Path' field. See Working with Menus: Administration Form.
For an internal path, you only need to input the path, not the entire URL (starting with http://<www.yourdomain.com>). For example, if the link is to a product description page with the path products/home/superbroom, then products/home/superbroom is all you need to input.
For an external URL, input the whole URL, starting with http:// .
For an email address, write mailto:, followed by the address: mailto:info@google.com , for example.
Putting a link into content text
To place a link into some text, such as text that says "click here" and sends the user to some other page or site, use the 'insert/edit link' function in your text editor. See the instructions for your text editor under Using Text and Image Editors.
If you want to show an external URL itself or an email address, you likely don't need to use the 'insert/edit link' function. Type the URL or email address normally – like www.google.com or email@google.com – and the text editor should automatically convert it into a link. (This only works in fields that use a text editor like TinyMCE or FCKeditor. And if it still doesn't work, you may need to configure your Input Format – a topic for later.)
Link to a Term's path
Recall that a "Term" is a "keyword" that tags your content. You can link to a Term, which will return all nodes tagged with that Term. For example, you can make a menu item named "See All Products" which links to the Term 'product', and when clicked returns all nodes tagged with the Term 'product'. An instant, simple product catalog!
A Term has a path like any other content, as described in Content Paths and URLs. Use it like any other path.
Link to multiple Terms
Now comes the powerful stuff: combining multiple Terms in one link. You can create a link that returns all nodes that are tagged with the Terms 'product' and 'technology', for a narrow list of only nodes that deal with both of those topics. Or you can create a link that returns all nodes that are tagged with the Terms 'product' or 'technology', for a broader list of all nodes about either of those topics.
First, note the path for each Term you'll use. For the following examples, say you'll use three Terms whose paths are taxonomy/term/1, taxonomy/term/5, and taxonomy/term/13:
AND combinations: Write the path like this:
taxonomy/term/1,5,13
to return nodes tagged with all three of the Terms.
OR combinations: Write the path like this:
taxonomy/term/1+5+13
to return nodes tagged with any one of the Terms.
Use the same format, separating numbers with commas or plusses, whether you're combining two Terms or twenty. (Naturally, you'll replace the above "1", "5", and "13" with the appropriate numbers you confirmed for your Terms.)
If you think the above sounds hard to remember, you aren't alone. It's definitely strange that OR combinations, not AND combinations, use the symbol "+" in their syntax. It sounds backward. Chalk it up to an odd quirk of Drupal, and move ahead.
Link to a Term and all its child Terms
Terms can be "hierarchical", with "child" Terms placed below a "parent" Term. (See Terms, Vocabularies, and Categories: "Tagging" Your Content.) One example: a Term 'machinery', with child Terms below it like 'pump', 'generator', etc.
If you'd like to create a link that picks up content tagged with the parent or any of its child – 'machinery' or 'pump' or 'generator' in the above example – there are three ways.
The first and simplest in concept: Make sure that you tag all pump-related nodes with 'pump' and 'machinery'. A link to the Term 'machinery' will pick up all pump info. But if you forget to include the tag 'machinery' on your Model 501 Grease Pump product description node, the link will miss it.
The second is as described above: link to the combined terms, like taxonomy/term/1+5+13. This link will catch the Model 501 Grease Pump node, on which you included the 'pump' tag but forgot the 'machinery' tag. That's better, but there's another problem: as you add new child Terms, you need to keep updating the link to include the new Terms (so that it ends up looking like taxonomy/term/1+5+13+24+25+31+33 and on and on.)
The third way is as follows. Link to the 'machinery' Term only, and tack on /all at the end of it. It might look like this:
taxonomy/term/1/all
That will pick up content tagged with Term 1 ('machinery' in this example), plus any child Terms below that, even any new ones you add. Handy!













Post new comment