Archive Site Perl Scripts

Why Have an Archive Banner?

Some web sites that are no longer actively maintained still contain information of importance or usefulness to the public or to scientists outside the Goddard firewall. These should remain online, but the end user should know that the data is no longer being updated. For this reason, an "archive" banner is required on each page of the site, somewhere above the regular page content.

What's in the Banner?

For small websites, adding the following text after the body tag is easily done on each web page:

    This web page's content and links are no longer actively maintained. It is available for reference purposes only. NASA Official: <name of active NASA employee with nasa.gov email link>

Use this code so it appears consistently across all Goddard websites:

    <h2 style="color:red;font-size:14px;background-color:#ffffff"><br />This web page's content and links are no longer actively maintained. It is available for reference purposes only. NASA Official: <a href="mailto:NASA_Official.Name_Here@nasa.gov">NASA_Official</a><br />&nbsp;</h2>

Using a Perl Script to Add the Banner

There is a Perl script that is useful when adding the archive banner to sites with more than a few pages. The script traverses directories and finds the tag (including any attibutes it might have) and adds on the banner right after it for each html file. This will have the effect of placing a banner at the very top of each web page on your site.

In order to run the script, Perl must be installed on the server. It's best if the person running the script knows Perl! The script should reside at the top of the directory tree where the site is hosted. You will need to edit the script to change the NASA Official's name and email address to the one appropriate for your site.

You are advised to make a back-up of all files before you run this script! This script will change your files! To run the script

  • on html files in one directory
    ls -1 *.html | ./archive_banner.pl x
  • on html files the next level of subdirectories
    ls -1 */*.html | ./archive_banner.pl x

The "x" at the end of the command tells the script to run but instead of actually changing files, it will dump a list of those changes into a file (called diff_dump) for review. The diff_dump file is created in the same directory as the perl scripts. Review the diff_dump file for sanity, then if all is well, run the script without the final "x" in the command to actually change your files.