Child pages
  • Web: convert absolute links to relative links
Skip to end of metadata
Go to start of metadata

There are ways to make links on the web or reference an image that will either 1) make thing harder for us later or 2) make things easier later. Here's the short scoop; Sharon or Randy could clarify for you if this is unclear:

  1. there are two major ways to make links within a web site; they are called absolute links and relative links. Absolute links are bad. Relative links are good!
  2. An absolute link would be something like:
  3. Relative links for the same items would look like this (basically, leave off the "", but do keep the "/" at the beginning:
    • /visit
    • /sites/default/files/images/large_image_for_image_content/co2_molecule_720x400.gif

Please start using this approach (relative links instead of absolute) now.

When we change our group's title to "Awesome" (or whatever!) and our web site becomes "", all relative links will still work. All absolute links will be broken.

Absolute links that were made in the past will have to be fixed at some point. Maybe Sharon will find a way to automatically change all of the old absolute links; or maybe not!

If not, someone (or many someones) will have to fix all those old links by hand. Yuck!!!

...and this is just a "best practice" thing you should get used to for any web sites you work on... for just this reason... that groups do sometimes have to change their names, or move their site from one hosting service to another. If you use relative links... no sweat! If you use absolute links... nightmare!

If you are linking to a site other than Spark, absolute links are fine (in fact, the only way to go)... this includes other NCAR/UCAR/UCP sites... so the following absolute links are fine:

Short version of this to remember:

  • leave "" off the beginning of your links or references to images (or PDFs or videos or whatever)
  • do keep the "/" at the beginning (it is essentially shorthand for "my site")
  • No labels