Since I have an interest in including images in some posts and providing PDF or spreadsheet downloads in others, how should that stuff be organized, named and referenced within my directory structure? While, of course, there are innumerable ways to handle these questions, here is the approach I have undertaken and refined, with some rationale for each.
Under my WordPress theme directory (AI3), I have set up separate subdirectories for files and images. Under each of those subdirectories, I have set up a number of parallel subdirectories:
I have three objectives for my naming conventions:
To achieve these objectives, I construct a four-part name:
The datestamp is provided in YYMMDD format. This order is used because it enables proper sorting in file managers or Open and Save dialogs. The sequence is simply an alphabetical sequence to account for potentially multiple posts within a given day. Most will obviously have the a sequence; rarely will there be more than a b to d in the sequence. The logicname is the content designator and is prefaced by an underscore for readability. (If there are multiple words in the logicname, I also initial cap with no spaces for readability and to save space.) For example, longer posts may have multiple images embedded in them; the logicname simply allows quick choices among these multiples. Lastly, the extension simply conforms to the file type.
Thus, a logo GIF included in my second post of June 25, 2005, could have an HTML reference in the post somewhat like (without angle brackets):
Note the first part of the path is a contextual reference to the subdirectory location on the server.
A sorted directory listing may also look somewhat as follows, with all related items properly sequenced and clustered:
Using these techniques provides uniformity of referencing within my posts and a quick, known path for getting to and identifying every file and image available.
Author’s Note: I actually decided to commit to a blog on April 27, 2005, and began recording soon thereafter my steps in doing so. Because of work demands and other delays, the actual site was not released until July 18, 2005. To give my ‘Prepare to Blog …’ postings a more contemporaneous feel, I arbitrarily changed posting dates on this series one month forward, which means some aspects of the actual blog were better developed than some of these earlier posts indicate. However, the sequence and the content remain unchanged. A re-factored complete guide will be posted at the conclusion of the ‘Prepare to Blog …’ series, targeted for release about August 18, 2005. mkb