Using the link node filter module

Often when you create a “Privacy Policy” or “Terms and Conditions” page you may have to link to another page within your drupal site. This can be a pain because you have to remember the full URL and you also have to know how to enter in HTML code. With the link node filter you can easily link to another node by entering:

[node:node_id,title="val2"]

Example:

[node:25,title="Privacy Policy"]

This will output:

<a href="/privacy_policy">Privacy Policy</a>

Before we get started go to http://drupal.org/project/link_node and download the module and place it in sites/all/modules.

Then enable at Administer >> Site building >> Modules.

Configure filter

Go to Administer >> Site configuration >> Input formats and click on configure. Scroll down to the Filters section and tick Link Node Filter and then click on Save configuration at the bottom of the page.

fig_1_link_node.png

Once again click configure and then click on the Configure tab.

fig_2_link_node.png

Scroll down to the Link Node codes.

fig_3_link_node.png

If you are linking to a page node you want to specify the title eg: "[node:node_id,title="val2"]" you must enter title to the Allowed parameters for page nodes.

fig_4_link_node.png

To test it out go to any node and enter in "[node:node_id,title="test page"]" in the body field and make sure the node_id is a page content type.

fig_5_link_node.png

If you are having any problems please leave a comment.

Comments

Anonymous's picture

The Freelinking module implements an input filter that provides much the same functionality; you can use double square brackets to enclose a link, and set the output link text (and alternate text for the link, as well, I believe). It works with internal and external links.

I think Freelinking sounds easier than what is described above, since it doesn't require you to know the node number, and it seems as if this solution does.

It would be nice if these two projects would merge somehow, so we just had one good canonical way to do this. Preferably in core or very close to it, as easy, friendly linking was a core feature of older CMSes than Drupal.

Anonymous's picture

I think Freelinking sounds easier than what is described above, since it doesn't
require you to know the node number, and it seems as if this solution does.

On my sites at least, titles of nodes are sometimes changed but the node IDs typically never do. Freelinking is less easy to use because of this.

ivan's picture
Member since:
7 February 2007
Last activity:
6 weeks 1 day

Thanks for that i'll look into it.

Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account, used to display your avatar.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <pre> <h2> <h3>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>. Beside the tag style "<foo>" it is also possible to use "[foo]". PHP source code can also be enclosed in <?php ... ?> or <% ... %>.

More information about formatting options