About linking and navigation – Adobe Dreamweaver CC 2014 v.13 User Manual
Page 434
About linking and navigation
About links
Absolute, document-relative, and site root-relative paths
Note: The user interface has been simplified in Dreamweaver CC and later. As a result, you may not find some of the options described in this
article in Dreamweaver CC and later. For more information, see
.
About links
After you’ve set up a Dreamweaver site to store your website documents and have created HTML pages, you’ll want to create connections from
your documents to other documents.
Dreamweaver provides several ways to create links to documents, images, multimedia files, or downloadable software. You can establish links to
any text or image anywhere within a document, including text or images in a heading, list, table, absolutely-positioned element (AP element), or
frame.
There are several different ways of creating and managing links. Some web designers prefer to create links to nonexistent pages or files as they
work, while others prefer to create all the files and pages first and then add the links. Another way to manage links is to create placeholder pages,
in which you add and test links before completing all your site pages.
Absolute, document-relative, and site root-relative paths
Understanding the file path between the document you’re linking from and the document or asset you’re linking to is essential to creating links.
Each web page has a unique address, called a Uniform Resource Locator (URL). However, when you create a local link (a link from one document
to another on the same site), you generally don’t specify the entire URL of the document you’re linking to; instead, you specify a relative path from
the current document or from the site’s root folder.
There are three types of link paths:
Absolute paths (such as http://www.adobe.com/support/dreamweaver/contents.html).
Document-relative paths (such as dreamweaver/contents.html).
Site root–relative paths (such as /support/dreamweaver/contents.html).
Using Dreamweaver, you can easily select the type of document path to create for your links.
Note: It is best to use the type of linking you prefer and are most comfortable with—either site root- or document-relative. Browsing to links,
as opposed to typing in the paths, ensures that you always enter the right path.
Absolute paths
Absolute paths provide the complete URL of the linked document, including the protocol to use (usually http:// for web pages), for example,
http://www.adobe.com/support/dreamweaver/contents.html. For an image asset, the complete URL might be something like
http://www.adobe.com/support/dreamweaver/images/image1.jpg.
You must use an absolute path to link to a document or asset on another server. You can also use absolute paths for local links (to documents in
the same site), but that approach is discouraged—if you move the site to another domain, all of your local absolute-path links will break. Using
relative paths for local links also provides greater flexibility if you need to move files within your site.
Note: When inserting images (not links), you can use an absolute path to an image on a remote server (that is, an image that is not available on
the local hard drive).
Document-relative paths
Document-relative paths are usually best for local links in most websites. They’re particularly useful when the current document and the linked
document or asset are in the same folder and are likely to remain together. You can also use a document-relative path to link to a document or
asset in another folder by specifying the path through the folder hierarchy from the current document to the linked document.
The basic idea of document-relative paths is to omit the part of the absolute path that is the same for both the current document and the linked
document or asset, providing only the portion of the path that differs.
For example, suppose you have a site with the following structure:
427