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:
- PaperName — wherein the ‘papername’ is set up for long, complicated posts
- Posts2005 (etc.) — all files or images for other posts are placed under this subdirectory. I chose to use the year designator knowing that the volume of my posts and associated files and images will require at least that level of granularity. Should too many files be placed in these directories, I may move to a quarterly designator in future years as well
- All images are placed under the images branch; all files (PDFs and XLSs, etc.) are placed under the files branch.
I have three objectives for my naming conventions:
- Enable files or images to be sorted in a logical order
- Enable files or images to be clustered within their parental post
- Provide some logical component in the name to identify the content of the file or image.
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
2 thoughts on “Preparing to Blog – File Organization and Naming”
I have a suggestion regarding your date format.
I’ve found that the yymmdd format leaves some ambiguity.
For example, 042505 could easily be viewed as either
yymmdd or ddmmyy, both common formats.
Expanding the format to yyyymmdd, you get all the benefit,
like sorting, without any ambiguity.
I think this is a good suggestion. It also works better when there are files from earlier than 2000, though granted that is a once in a millenium event (though using the full YYYY would also work better every 100 years)!
I will switch to this new method.