Linking from Other Documents into the GED2HTML Output Files

GED2HTML can be used to prepare genealogical data to go along with other HTML documents, such as a family history. In doing this, it is useful to be able to link from these other documents to the individual data pages output by GED2HTML. Let's see how this can be done.

When you run GED2HTML, it outputs a directory structure consisting of a number of subdirectories (D0001/, D0002/, D0003/, etc.) and files within subdirectories (either G0000001.html, G00000002.html, G0000003.html, etc., or else I1.html, I2.html, I3.html, etc., depending on whether you have asked for multiple individuals to be placed in a single output file). For the purposes of discussion, let's suppose that the Dxxxx/ directories are all located under a single top-level directory HTML/ (this is the default under Windows).

Now, suppose you wish to include the output of GED2HTML in a hypertext book you are writing. You might create a top-level directory BOOK/, and with the HTML/ directory a subdirectory. The text of your book might be in files chap1.html, chap2.html, chap3.html, etc. under a TEXT/ subdirectory of the BOOK/ directory. So, you would have the following directory and file structure:

BOOK/ TEXT/ chap1.html chap2.html chap3.html HTML/ D0001/ G0000001.html G0000002.html D0002/ G0000003.html D0003/

Suppose you want to put a link in the HTML file "chap1.html" that links to individual "Joe Blow" with RIN "I151", whose HTML file output by GED2HTML happens to be in file

BOOK/HTML/D0002/G0000003.HTM (You can find out exactly what file the individual data is in by using a Web browser on the index to find the individual, and then recording the URL you are viewing.) To link to this individual, the best way to do it is to use an anchor with a "relative URL", which would appear as follows: <A HREF="../HTML/D0002/G0000003.HTM#I151">Joe Blow</A> The ".." means "go up to the parent directory", and the rest describes how to go down into the particular file (G0000003.HTM) that contains the individual with RIN I151. The last "#I151" is a bookmark that indicates where this individual's data is in the file "G0000003.HTM".

The relative URL as above has the advantage that you can move the whole BOOK/ directory tree somewhere else on the system, and you won't have to change any of the links. However, if you change the position of the file "chap1.html" relative to the HTML/ directory, you will have to change the URL to reflect the difference.

Now, let's consider what happens if you add more data to your GEDCOM, and you'd like to reprocess it for your book. Ideally, you would just re-run GED2HTML and replace the contents of the HTML/ directory by the output files from the new run. This works, as long as you don't change the number of individuals in your GEDCOM. If you change the number of individuals between runs, then on the second run, GED2HTML might decide to use a different number of directories than it did on the first run. This is because the default behavior of GED2HTML is to figure out how many directories you need to hold all your data, with the default number of files per directory and individuals per file. If GED2HTML decides more directories are needed on the second run, then after this run all the links in your book will point to the wrong places.

Fortunately, there is a way around this difficulty. GED2HTML includes a "stable filenames" option in which the subdirectory and file a particular individual should go in is calculated from the individuals cross-reference ID using something technically known as a "hash function". If "stable filenames" are enabled, then as long as the same number of subdirectories and files per subdirectory are being used, the same individuals will end up in the same places, regardless of what other individuals have been added to or deleted from the GEDCOM.

By default, GED2HTML has a certain number of individuals that it tries to put in each file. It computes the required number of subdirectories and files per subdirectory based on this parameter and the total number of individuals in the GEDCOM. However, if you change the number of individuals in your GEDCOM and you wish to take advantage of the stable filenames option, then you need to tell GED2HTML to use a specific number of directories and a specific number of files per directory. GED2HTML permits you do to this by specifying the appropriate processing options.

So, suppose the first time you run GED2HTML you use the default options, which under Windows are 10 individuals per file, 100 files per subdirectory, and as many subdirectories as are needed. Suppose you ended up with three subdirectories: D0001/, D0002/, and D0003/. You then add links from the text of your book into the HTML pages in these subdirectories. At a later date, after modifying your GEDCOM, you decide you want to re-run GED2HTML on the new GEDCOM. You should tell GED2HTML on this second run to use three subdirectories and 100 files per subdirectory. As a result, all individuals that were present in the original GEDCOM will end up in the same files after the second run as they did after the first.

There are two disadvantages to the "stable filenames" feature, which might make you want to disable it if you are not trying to link into your database from external documents. The first disadvantage is that the assignment of individuals to files using stable filenames appears random, so that individuals from the same family group will not likely end up in the same file. The second disadvantage is that using stable filenames GED2HTML is not always able to do a very good job at packing a uniform number of individuals in each file. If you disable the stable filenames feature, then GED2HTML assigns individuals to files in alphabetical order by surname, and it always puts the maximum number of individuals in each file.

GED2HTML home page

Copyright © 1995-2000 Eugene W. Stark. All rights reserved.
SEND ME EMAIL