-
Notifications
You must be signed in to change notification settings - Fork 36
ref archivefilepath
Archive File Path Specifiers are used when creating Archive Mappings and formulating links to files published by the Archive Templates within the system.
Archive mappings are the paths Melody creates when it publishes a files using an archive template. Archive mappings determine the URLs of all file published by the archive templates: entries, pages, monthly archives, etc.
One template may have multiple mappings; the author and author-monthly files may be published by the same template and have some conditional logic (mt:If, mt:Else, mt:Unless, etc) using archive template variables.
To create a "Monthly" archive mapping such as:
2008/12/index.html
...use %y for a 4-digit year, %m for a 2-digit month, and %i for the default index file name. Separate the specifiers with forward slashes denoting the path:
%y/%m/%i
To create a "Category" archive mapping such as:
category/sub-category/index.html
...use %-c for a dash-separated category path and and %i for the default index file name separated by slashes like this:
%-c/%i
To create an "Entry" archive mapping like this:
2008/12/entry-basename.html
...use 4-digit year, 2-digit month, and entry basename with the archive file extension specified in publishing preferences:
%y/%m/%-f
Archive File Path Specifiers are used by various Melody tags that create links (such as the mt:EntryPermalink tag). When an archive mapping ends with the the directory index--a combination of IndexBasename and the archive file extension specified in publishing preferences, which is "index.html" for most servers--Melody will remove it from the url.
Thus if the actual paths to an entry and a monthly archive are like this:
2008/12/entry-basename/index.html
2008/12/index.html
Then Melody will create links (respectively) to the above files without the directory index filename:
<a href="2008/12/entry-basename/"><!-- foo entry --></a>
<a href="2008/12/"><!-- foo monthly archive --></a>
The below archive paths suggested values in Melody. The default option for each archive type is in bold.
<tr><td><strong>Page</strong></td><td><code>folder-path/page-basename.html</code></td><td><code>%-c/%-f</code></td></tr>
<tr><td>Page</td><td><code>folder-path/page-basename/index.html</code></td><td><code>%-c/%-b/%i</code></td></tr>
<tr><td>Page</td><td><code>folder_path/page_basename.html</code></td><td><code>%c/%f</code></td></tr>
<tr><td>Page</td><td><code>folder_path/page_basename/index.html</code></td><td><code>%c/%b/%i</code></td></tr>
<tr><td><strong>Daily</strong></td><td><code>yyyy/mm/dd/index.html</code></td><td><code>%y/%m/%d/%f</code></td></tr>
<tr><td><strong>Weekly</strong></td><td><code>yyyy/mm/day-week/index.html</code></td><td><code>%y/%m/%d-week/%i</code></td></tr>
<tr><td><strong>Monthly</strong></td><td><code>yyyy/mm/index.html</code></td><td><code>%y/%m/%i</code></td></tr>
<tr><td><strong>Yearly</strong></td><td><code>yyyy/index.html</code></td><td><code>%y/%i</code></td></tr>
<tr><td><strong>Category</strong></td><td><code>category/sub-category/index.html</code></td><td><code>%-c/%i</code></td></tr>
<tr><td>Category</td><td><code>category/sub_category/index.html</code></td><td><code>%c/%i</code></td></tr>
<tr><td><strong>Category-Daily</strong></td><td><code>category/sub-category/yyyy/mm/dd/index.html</code></td><td><code>%-c/%y/%m/%d/%i</code></td></tr>
<tr><td>Category-Daily</td><td><code>category/sub_category/yyyy/mm/dd/index.html</code></td><td><code>%c/%y/%m/%d/%i</code></td></tr>
<tr><td><strong>Category-Monthly</strong></td><td><code>category/sub-category/yyyy/mm/index.html</code></td><td><code>%-c/%y/%m/%i</code></td></tr>
<tr><td>Category-Monthly</td><td><code>category/sub_category/yyyy/mm/index.html</code></td><td><code>%c/%y/%m/%i</code></td></tr>
<tr><td><strong>Category-Weekly</strong></td><td><code>category/sub-category/yyyy/mm/day-week/index.html</code></td><td><code>%-c/%y/%m/%d-week/%i</code></td></tr>
<tr><td>Category-Weekly</td><td><code>category/sub_category/yyyy/mm/day-week/index.html</code></td><td><code>%c/%y/%m/%d-week/%i</code></td></tr>
<tr><td><strong>Category-Yearly</strong></td><td><code>category/sub-category/yyyy/index.html</code></td><td><code>%-c/%y/%i</code></td></tr>
<tr><td>Category-Yearly</td><td><code>category/sub_category/yyyy/index.html</code></td><td><code>%c/%y/%i</code></td></tr>
<tr><td><strong>Author</strong></td><td><code>author/author-basename/index.html</code></td><td><code>author/%-a/%f</code></td></tr>
<tr><td>Author</td><td><code>author/author_basename/index.html</code></td><td><code>author/%a/%f</code></td></tr>
<tr><td><strong>Author-Daily</strong></td><td><code>author/author-basename/yyyy/mm/dd/index.html</code></td><td><code>author/%-a/%y/%m/%d/%f</code></td></tr>
<tr><td>Author-Daily</td><td><code>author/author_basename/yyyy/mm/dd/index.html</code></td><td><code>author/%a/%y/%m/%d/%f</code></td></tr>
<tr><td><strong>Author-Montly</strong></td><td><code>author/author-basename/yyyy/mm/index.html</code></td><td><code>author/%-a/%y/%m/%f</code></td></tr>
<tr><td>Author-Monthly</td><td><code>author/author_basename/yyyy/mm/index.html</code></td><td><code>author/%a/%y/%m/%f</code></td></tr>
<tr><td><strong>Author-Weekly</strong></td><td><code>author/author-basename/yyyy/mm/day-week/index.html</code></td><td><code>author/%-a/%y/%m/%d-week/%f</code></td></tr>
<tr><td>Author-Weekly</td><td><code>author/author_basename/yyyy/mm/day-week/index.html</code></td><td><code>author/%a/%y/%m/%d-week/%f</code></td></tr>
<tr><td><strong>Author-Yearly</strong></td><td><code>author/author-basename/yyyy/index.html</code></td><td><code>author/%-a/%y/%f</code></td></tr>
<tr><td>Author-Yearly</td><td><code>author/author_basename/yyyy/index.html</code></td><td><code>author/%a/%y/%f</code></td></tr>
Archive Type | Archive Path | Specifier String |
---|---|---|
Entry | yyyy/mm/entry-basename.html |
%y/%m/%-f |
Entry | yyyy/mm/entry_basename.html |
%y/%m/%f |
Entry | yyyy/mm/entry-basename/index.html |
%y/%m/%-b/%i |
Entry | yyyy/mm/entry_basename/index.html |
%y/%m/%b/%i |
Entry | yyyy/mm/dd/entry-basename.html |
%y/%m/%d/%-f |
Entry | yyyy/mm/dd/entry_basename.html |
%y/%m/%d/%f |
Entry | yyyy/mm/dd/entry-basename/index.html |
%y/%m/%d/%-b/%i |
Entry | yyyy/mm/dd/entry_basename/index.html |
%y/%m/%d/%b/%i |
Entry | category/sub-category/entry-basename.html |
%-c/%-f |
Entry | category/sub-category/entry-basename/index.html |
%-c/%-b/%i |
Entry | category/sub_category/entry_basename.html |
%c/%f |
Entry | category/sub_category/entry_basename/index.html |
%c/%b/%i |
Archive Mappings are found under "Template Options" at the bottom of each archive template.
- Navigating to "Design > Templates".
- Edit an archive template such as: Entry, Entry Listing, Monthly Entry Listing, etc.
- At the bottom of the screen click "Template Options" to reveal the archive mappings associated with a template.
Melody template tags can be used directly in the archive mapping.
For example, to publish entries at a URL like:
2009/September/16/basename.html
Use the mt:EntryDate tag which has additional date formats to produce the archive mapping like this:
%y/<$mt:EntryDate format="%B"$>/%d/%-f
or output the whole date and slashes using the tag:
<$mt:EntryDate format="%Y/%B/%d"$>/%-f
Warning: users should be aware that the use of template tags, while advantageous in some circumstance, carries with it some risks. There is no absolute guarantee that the output of a template tag and any combined modifier like
dirify="1"
will be consistent from one version to the next. If you rely on template tags in your archive mappings, please play close attention to the Melody change log prior to upgrading to anticipate any changes to relied upon behavior.*
- Using a dash after the percent sign will cause the specifier to use dashes instead of underscores. If
%a
producesmelody_nelson
, then%-a
would producemelody-nelson
. - In some of the cases the uppercase variants exist and can be used to produce an alternate version of the value returned by the lowercase specifier.
The author basename (<$mt:AuthorBasename$>
). Example: melody_nelson
The same as %a
.
The same as above except using dashes. Example: melody-nelson
For individual archive mappings, this returns the <$mt:EntryBasename$>
. By default, this is the first thirty characters of an entry dirified with underscores. It can be specified by using the basename field on the edit entry screen. Example: my_summer_vacation
The same as %b
.
Same as the above but uses dashes instead of underscore. Example: my-summer-vacation
Same as the above but uses dashes instead of underscore. Example: my_summer_vacation
The primary category/subcategory path of an entry constructed using category basenames (<$mt:SubCategoryPath$>
). Example: arts_and_entertainment/tv_and_movies
The same as %c
.
Same as above but using dashes. Example: arts-and-entertainment/tv-and-movies
The basename of the primary category of the entry (<$mt:CategoryBasename$>
). Example: tv_and_movies
Same as above but using dashes. Example: tv-and-movies
2-digit day of the month. Same as <$mt:ArchiveDate format="%d"$>
. Example: 09
3-letter language-dependent abbreviation of the week day. Same as <$mt:ArchiveDate format="%e" trim="1"$>
Example: Tue
A numeric entry ID padded with leading zeroes to six digits. Same as <$mt:EntryID pad="1"$>
Example: 000040
The numeric ID of the entry. Same as <$mt:EntryID pad="0"$>
Example: 40
Archive filename with the archive file extension specified in publishing preferences. This can be used instead of %b or %i and will do the right thing based on the context. Same as <$mt:ArchiveFile$>
. Example: entry_basename.html
or index.html
Same as %f
but using dashes. Example: entry-basename.html
Same as "%f" but without the file extension. Same as <$mt:ArchiveFile extension="0"$>
. Example: entry_basename
Same as "%f" but without the file extension and using dashes. Same as <$mt:ArchiveFile extension="0" separator="-"$>
. Example: entry-basename
2-digit hour on a 24-hour clock with a leading zero if applicable. Same as <$mt:ArchiveDate format="%H"$>
. Example: 09
for 9am, 16
for 4pm
2-digit hour on a 24-hour clock without a leading zero if applicable. Same as <$mt:ArchiveDate format="%k" trim="1"$>
. Example: 9
for 9am, 16
for 4pm
The setting of the IndexBasename configuration directive with the default file extension appended. Same as <$mt:IndexBasename extension="1"$>
. Example: index.html
Same as %i
but without the file extension. Same as <$mt:IndexBasename$>
. Example: index
3-digit day of year, zero-padded. Same as <$mt:ArchiveDate format="%j"$>
. Example: 040
2-digit month, zero-padded. Same as <$mt:ArchiveDate format="%m"$>
. Example: 07
3-letter month. Same as <$mt:ArchiveDate format="%b"$>
. Example: Sep
or Jan
2-digit minute, zero-padded. Same as <$mt:ArchiveDate format="%M"$>
. Example: 04
Current page number. Same as <mt:PagerBlock><mt:IfCurrentPage><$mt:Var name="__value__"$></mt:IfCurrentPage></mt:PagerBlock>
2-digit second, zero-padded. Same as <$mt:ArchiveDate format="%S"$>
. Example: 01
File extension with a leading dot (.). Same as <$mt:BlogFileExtension$>
. If a file extension has not been specified a blank string is returned. Example: .html
4-digit year. Same as <$mt:ArchiveDate format="%Y"$>
. Example: 2005
2-digit year with zero-padding. Same as <$mt:ArchiveDate format="%y"$>
. Example: 05
Questions, comments, can't find something? Let us know at our community outpost on Get Satisfaction.
- Author: Six Apart Ltd., Byrne Reese
- Edited by: Byrne Reese, Violet Bliss Dietz