海角社区

Should I use node numbers to link to content?

Nope. Well, it depends.

Drupal at its core, is built on the concept of nodes and each node has an ID. Nodes can be accessed via the URL, e.g., may work but may not always be the right solution. You can find the node URL when editing a node: hover over the 鈥楴ew draft鈥 (edit) tab and you should see 鈥樷.

Screen Shot 2016-08-04 at 10.01.32 AM

When to use node IDs

Node IDs should be used when designing the structure of your site, for example, placing a block on a page should use a node ID.

Page visibility on block settings: use node numbers because you are building the infrastructure of your site; you want those blocks to stick to that content.

When to use an alias

Use an alias when sharing or displaying links to any content.

Linking to any content on your site or another Drupal site:

Links that visitors will interact with should always use an alias; this will keep the content accessible. Imagine that you use a screen reader and someone tells you, 鈥渉ey, go to .鈥 You wouldn鈥檛 know what you鈥檙e getting yourself into. It would be more useful and considerate to reveal, 鈥渉ey, go to ,鈥 informing the visitor what content they will receive before they click.

To summarize, use node ID for creating the structure of your site, and alias for addressing content that visitors will interact with.

If accessibility doesn鈥檛 pull your wagon, it will also improve Google search rankings as well.

Back to top