Changing Links
Moving files works much in the same way. If you need to move a file out of or into a different directory, be sure to do it in the Site window. Again, if documents are linked to the one you are moving, broken hyperlinks occur if Dreamweaver isn't aware of the change. If you move the file within the Site window, you will get the Update Files dialog box, just like in the previous exercise.
You can also easily change where links point to by using the change link command.
Change Links by Using the Change Link Command
To change a link by using the change link command, follow these steps:
Highlight the file for the link you want to change.
Select Site, Change Link to access the Select HTML File dialog box. You can also press Command+L (Mac) or Ctrl+L (Windows) to access the dialog box, or you can contextual click the icon and choose Change Link from the contextual menu.
Locate the HTML file you want the old link to point to. When you're happy with your selection, click the Done button.
After you choose the new file, the Update Files dialog box will appear, displaying all the files that need to be updated.
If you want all the files to be updated, click Update. However, if you want only certain files to be updated, highlight the files by clicking them. When clicking more than one, be sure to hold down the Command key (Mac) or Control Key (Windows).
If you don't want any of the files to be updated, choose Don't Update.
Change Link Sitewide
A very similar command to the Change Link command is the Change Link Sitewide command. With this command you essentially redirect all links from one page to another.
To use the change link sitewide command, follow these steps.
In the Site window/panel, select the file that you want to change.
-
Choose Site, Change Link Sitewide. You can also contextual click the icon and choose the Change Link Sitewide command from the contextual menu. This launches the Change Link Sitewide dialog box, as pictured in Figure 3.21.
Figure 3.21 The Change Link Sitewide dialog box.
-
You can also select the Change Link Sitewide command without a file select; however, the top text field in the dialog box will be empty, requiring you to fill it out. In the second text field (the one labeled Into Link To) either type in the path to the new file you want the link to point to, or click the folder icon at the end of the text field to search for a file. If you search for a file within your local root folder, the correct addressing will be added to the filename.
-
When you're happy with the new file, click OK to bring up the Update Files dialog box. Refer to step 5 of the previous exercise for more information on how to handle this dialog box.
Deleting Links
Sometimes in Web site development, you may want to remove a link between different pages. You would accomplish this again in the Site window/panel. Because you want to change an attribute of a link, you want to make sure that Dreamweaver is fully aware of the situation, so it can make any necessary adjustments to other pages to preserve the link integrity of the Web site.
To remove or delete a link, highlight the file that you want to delete and either press the Delete key on your keyboard or choose Site, Remove Link, or contextual click and choose Remove Link from the contextual menu.