Collect Plugin for Movable Type
Current version: 1.2 (7/12/04)
- Download (.tar.gz file)
- Plugin Code (.pl file)
- About the Collect Plugin
- MTCollect
- MTCollectThis
- MTIfCollected
- MTCollected
- MTCollectedEntryTags
- MTCollectedTag
- MTCollectedContent
- MTCollectedSite
- MTCollectedAttr
- MTIfCollectedContent
- MTIfCollectedSite
- MTIfCollectedAttr
- MTCollectedGroup
- MTCollectedTotalCount
- MTCollectedGroupCount
- MTCollectedIndex
- MTCollectedArchive
- Usage Examples
- Version History
About the Collect Plugin
This Movable Type plugin implements a set of template tags for collecting information from specified HTML tags in your entries, and collating and displaying that information. This lets you enhance your MT-based pages in a variety of ways. For example, you could:
- Display footnotes for the links or images that appear within each entry. The StripTags plugin could also do this; since this plugin can do everything StripTags can do and much more, StripTags is superseded by Collect and will no longer be updated. See the Usage Examples section, below, for some examples of how to duplicate the functionality of StripTags with Collect.
- Generate a "Recent Links" listing to display in your sidebar.
- Create "by citation" or "by quotation" archives, similar to the ones Mark Pilgrim has on his site. (Of course, this requires that your entries have the appropriate semantic markup.)
- For a photography weblog, make an index page showing thumbnails for all images that have appeared in your entries (assuming you have thumbnail versions and they're named consistently).
- Build a glossary of terms you've marked up with definitions using the
acronym
tag.
Since some of the examples of using the plugin are a bit involved, most of the working example code is deferred until the Usage Examples section toward the end of this document. Before reading the documentation for the individual tags, you might want to glance over some of the examples to get an overview of how it all works.
Please note that the Collect plugin does not do any validation of your HTML syntax. In fact, it gathers tags in a fairly simplistic way, so that if you have improperly nested tags within your entries, you'll probably get unexpected results. Also, the tags and attributes you tell the plugin to collect don't have to be legitimate HTML tags and attributes, but it's probably not advisable to take advantage of this fact to use non-standard tags or attributes, or put attributes into tags that aren't supposed to take them.
Thanks to Stepan Riha for testing and suggestions, and to Mark Pilgrim for the "Posts by Citation/Quotation" idea.
Installation
To install the Collect plugin, upload the file Collect.pl to the plugins directory within your Movable Type directory. If you do not already have a plugins directory, create one before uploading the file. For more information about Movable Type plugins, see the documentation.
Support
Please use the support forums for all support requests, bug reports, feature requests, questions, and comments regarding this plugin.
MTCollect
This container tag tells the plugin to collect data from specified HTML tag(s). All other tags defined by the Collect plugin must be used within MTCollect
. An MTCollect
container should surround an entire collection operation, both the "input" portion (the entry text from which you collect information using MTCollectThis
) and the "output" portion (in which you list the collected information using MTCollected
and related tags). In other words, while you can have multiple MTCollect
tags in one template, the information gathered by one instance of MTCollect
cannot be accessed from within another instance.
If you're collecting tags from multiple entries and combining them into a single listing, MTCollect
should go around MTEntries
. But if you're collecting tags entry-by-entry (for example, to show footnotes for each entry), MTCollect
should go within MTEntries
.
The tag takes the following attributes:
- tags="tag1,tag2.." (required)
The names of one or more HTML tags you want to collect. Multiple tags should be separated by commas. - urls="attr_name1,attr_name2,content.." (optional)
If you're going to use theMTCollected
tag with thegroup_by="site"
option, described below, to display collected tag information summarized by site, you need to tell the plugin in advance which tag attribute(s) will contain URLs, so it knows where to find the site corresponding to each tag instance. To indicate this, pass one or more tag attribute names, separated by commmas, inurls
. Passcontent
to indicate that the content of the collected tags (the text between the opening and closing tag) will be a URL.
The following example tells the plugin you're going to collect blockquote
tags, and the cite
attribute of each tag instance will contain a URL:
<MTCollect tags="blockquote" urls="cite"> ... </MTCollect>
MTCollectThis
This container tag should surround the text from which you want to collect tags. MTCollectThis
should go within MTEntries
, even if MTCollect
is outside MTEntries
. You're not limited to collecting from the entry body; you can place any other MT template tags within MTCollectThis
. The following example collects tags from the entry body and extended entry:
<MTEntries> <MTCollectThis> <$MTEntryBody$> <$MTEntryMore$> </MTCollectThis> </MTEntries>
The tag takes the following attributes:
- show="1" (optional)
By default,MTCollectThis
collects tags from the text within it, but does not display its contents. Pass theshow
attribute if you do want to display the tag's contents. - [tagname]="format" (optional)
If you're collecting tags for purposes of footnoting, you may want to insert text before and/or after the tagged text. Other thanshow
, every attribute you pass toMTCollectThis
will be treated as a tag name, indicating that the text specified in theformat
string should be inserted next to each instance of that tag.The
format
string can have two parts, separated by a slash: whatever comes before the slash will be inserted before each instance of<tagname>
, and whatever comes after the slash will be inserted after each instance of</tagname>
, if applicable. HTML entities within the formatting strings will be decoded, so you can include HTML tags by using<
and>
in place of angle brackets. If you want to include a literal slash within one of the parts of the formatting string, you can either escape it with a backslash (\/
) or use the HTML code/
.By using
MTCollectThis
with MT's standardremove_html
global attribute, you can duplicate the functionality of the StripTags plugin. Some examples of this are in the Usage Examples section below.Within
format
,[N]
will output the number of the tag instance. The name of any tag attribute (non-case-sensitive) in square brackets will be replaced with that attribute, if it appears in that instance of the tag. To include literal square brackets in theformat
string, escape them with a backslash. The following example will replace each image with a string containing the image's path or URL:<MTCollectThis img="\[IMAGE: [src]\]" show="1" remove_html="1"> <$MTEntryBody$> </MTCollectThis>
MTIfCollected
This container tag displays its contents if and only if at least one instance of any of the specified tags was collected by MTCollectThis
. Otherwise, it displays nothing.
The tag takes the following attribute:
- tags="tag1,tag2.." (optional)
The names of one or more HTML tags that must have been collected for MTIfCollected to display its contents. Multiple tags should be separated by commas. If you don't passtags
,MTIfCollected
will check for all the tags you originally toldMTCollect
to collect. - show_local="1" (optional)
By default, if you pass aurls
value toMTCollect
,MTIfCollected
will ignore tag instances with a blank site valuein other words, relative links to pages or images on your own site. Pass this attribute if you wantMTIfCollected
to take tags with no site into account.
MTCollected
This container tag loops through the tags that were collected by MTCollectThis
. Within MTCollected
, the other MTCollected* tags can be used to display various pieces of the collected tag information.
MTCollected
can produce two basic types of listings: grouped and non-grouped. If the group_by
attribute is not passed, MTCollected
simply loops through the collected tags, displaying its contents once for each tag instance that was collected. If the group_by
attribute is passed, MTCollected
collates the tags into groupings according to the passed value, and displays its contents once for each grouping.
You can place an MTEntries
tag within a grouped MTCollected
listing, or within a template that's loaded by MTCollectedArchive
. For each grouping displayed, MTEntries
will list all the entries that contain tag instances that are part of that grouping. If you want to list the individual tag instances that are part of each entry, use MTCollectedEntryTags
within MTEntries
.
The tag takes the following attributes:
- tags="tag1,tag2.." (optional)
The names of one or more HTML tags you want to display. Multiple tags should be separated by commas. If you don't passtags
,MTCollected
will list all the tags you originally toldMTCollect
to collect. Note that you can collect multiple tags with a single MTCollect, then list them separately by using MTCollected more than once:<MTCollect tags="a,img"> ...<MTCollectThis>...</MTCollectThis> <MTCollected tags="a"> ...[this section will list anchor tags] </MTCollected> <MTCollected tags="img"> ...[this section will list image tags] </MTCollected> </MTCollect>
- group_by="content|site|attr_name" (optional)
Passing this attribute tellsMTCollected
to create a grouped listing and display its contents once for each group. The possible types of grouping are:content
: All tag instances whose content (the text between the opening and closing tags) is identical will be grouped together.site
: All tag instances that refer to the same site will be grouped together. The site is taken from whichever tag attribute(s) you indicated with theurls
value passed toMTCollect
. Basically, the site for each URL is considered to be the machine name, butwww.
at the beginning is ignored, so links tohttp://www.mysite.com
andhttp://mysite.com
will be grouped together.attr_name
: If you pass the name of a tag attribute, all tag instances where that attribute is the same will be grouped together. This won't be very useful in most cases (it doesn't make much sense to group byhref
orsrc
, for example), but it's there if you need it.
- sort_by="count|group|content|site|attr_name" (optional)
This tellsMTCollected
how you want the listing sorted. For grouped listings, the possible sort orders are:count
: The listing will be sorted numerically according to the number of tag instances belonging to each group.group
: The listing will be sorted alphabetically according to the name of each groupwhich will be either tag content, site, or an attribute, depending on whatgroup_by
value you're using. This is the default sort order if you don't passsort_by
.
For non-grouped listings, if you don't specify
sort_by
, the tag instances will simply be listed in the order in which they originally appeared in the text from which they were collected. The other possible sort orders are:content
: The listing will be sorted alphabetically according to the content of each tag instance.site
: The listing will be sorted alphabetically according to the site corresponding to each tag instance, which is determined as described above.attr_name
: Pass the name of a tag attribute to sort the listing alphabetically according to the value of that attribute for each tag instance.
- sort_order="ascend|descend" (optional)
The order in which the listing should be sorted. The default is an ascending sort. - skip_dupes="1" (optional)
In a sorted non-grouped listing, pass this to omit any tag instance whose sort key (attribute, content, or site) is the same as the one above it in the listing. - show_local="1" (optional)
This applies to non-grouped listings and listings grouped bysite
. By default,MTCollected
will skip items with a blank site valuein other words, relative links to pages or images on your own site. Pass this attribute if you want the listing to include items with no site. (Note that if you do want to skip local links, you must pass aurls
value toMTCollect
so the plugin knows which attribute contains the site.) - lastn="N" (optional)
If you pass this attribute,MTCollected
will restrict the listing to the topN
itemseither groupings or tag instancesthat would appear in the sorted list. - min_count="N" (optional)
Applies to grouped listings only. If you pass this attribute,MTCollected
will only display groupings that containN
or more tag instances.
MTCollectedEntryTags
This container tag must be called from within an MTEntries
tag. That MTEntries
tag, in turn, must either be within a grouped MTCollected
listing or in a template that's loaded by MTCollectedArchive
.
For a given entry, MTCollectedEntryTags
loops through all the tag instances collected from that entry that belong to the current grouping. Within MTCollectedEntryTags
, use MTCollectedTag
, MTCollectedSite
, MTCollectedContent
, and MTCollectedAttr
to display the respective pieces of each tag instance.
The tag takes the following attribute:
- tags="tag1,tag2.." (optional)
The names of one or more HTML tags whose instances you want to loop through. Multiple tags should be separated by commas. If you don't passtags
,MTCollectedEntryTags
will loop through all the tags you originally toldMTCollect
to collect.
MTCollectedTag
Within a non-grouped MTCollected
listing or within MTCollectedEntryTags
, displays the name (such as a
or img
) of the current tag instance.
MTCollectedContent
Within a non-grouped MTCollected
listing or within MTCollectedEntryTags
, displays the content (the text between the opening and closing tags) of the current tag instance.
MTCollectedSite
Within a non-grouped MTCollected
listing or within MTCollectedEntryTags
, displays the site of the current tag instance. (You must have passed the urls
attribute to MTCollect
in order for the site information to have been collected.)
MTCollectedAttr
Within a non-grouped MTCollected
listing or within MTCollectedEntryTags
, displays a particular attribute (such as href
or src
) of the current tag instance.
The tag takes the following attribute:
- attr="attr_name" (required)
The name of the tag attribute to display.
MTIfCollectedContent
Within a non-grouped MTCollected
listing or within MTCollectedEntryTags
, this container tag displays its contents if and only if the current tag instance has some text between its opening and closing tags.
MTIfCollectedSite
Within a non-grouped MTCollected
listing or within MTCollectedEntryTags
, this container tag displays its contents if and only if the current tag instance has a site. (You must have passed the urls
attribute to MTCollect
in order for the site information to have been collected.)
MTifCollectedAttr
Within a non-grouped MTCollected
listing or within MTCollectedEntryTags
, this container tag displays its contents if and only if the current tag instance has a non-blank value in the specified attribute.
The tag takes the following attribute:
- attr="attr_name" (required)
The name of the tag attribute to look for.
MTCollectedGroup
Within a grouped MTCollected
listing or in a template that's loaded by MTCollectedArchive
, displays the name of the current grouping (content, site, or attribute).
MTCollectedTotalCount
Displays the total number of tag instances collected.
The tag takes the following attribute:
- tags="tag1,tag2.." (optional)
The names of one or more HTML tags whose instances you want to count. Multiple tags should be separated by commas. If you pass multiple tags, the count will be the total number of collected instances of all specified tags. If you don't passtags
, the count will be the total number of instances of all tags.
MTCollectedGroupCount
Within a grouped MTCollected
listing or in a template that's loaded by MTCollectedArchive
, displays the number of tag instances belonging to the current grouping.
The tag takes the following attribute:
- tags="tag1,tag2.." (optional)
The names of one or more HTML tags whose instances you want to count. Multiple tags should be separated by commas. If you pass multiple tags, the count will be the total number of collected instances of all specified tags within this grouping. If you don't passtags
, the count will be the total number of instances of all tags within this grouping.
MTCollectedIndex
Within an MTCollected
listing, either grouped or non-grouped, displays the loop index.
MTCollectedArchive
This container tag must be used within a grouped MTCollected
listing. Its purpose is to create an archive page on your site that corresponds to each grouping. Please understand this: Using this tag causes pages to be created on your site. That's not necessarily a bad thing, but it is an unusual thing for a plugin tag to do, so you should be sure you know what you're doing before using this tag. It's probably a good idea to build your template first without the MTCollectedArchive
tag, and view the results, so you can see what files and/or directories will be created.
The tag is meant to be used on an index template. Since archive templates are built multiple times on each rebuild, it probably wouldn't be wise in most cases to use MTCollectedArchive
on an archive template.
MTCollectedArchive
displays its contents, stripped of any leading or trailing whitespace; and it also uses its contents as the filename of a file, and creates that file on your server. The file is created by building the MT template you specify in the template
attribute. The idea is to use the MTCollectedGroup
tag within MTCollectedArchive
, so that a file is created with a name corresponding to each grouping.
The file is created in a location relative to your Local Archive Path for this weblog. You can also include a partial path before the filename to indicate that the files created should be placed in a particular directory within your Local Archive Path.
Let's say you have an MTCollected
listing, grouped by site, that produces four groupings:
apple.com mt.sixapart.com nytimes.com search.cpan.org
You want to create an archive page that lists citations from each of these sites, within the directory cite_archive
. Let's assume your Local Archive Path is /www/mydomain/mtsite/
. You might use the following code within MTCollected
:
<p><a href="/mtsite/<MTCollectedArchive template="collection"> cite_archive/<$MTCollectedGroup dirify="1">.html </MTCollectedArchive>"><$MTCollectedGroup$></a>
Note that at the same time as you're using MTCollectedArchive
to create the file, you're also using standard HTML to display a link to the file that will be created. Since mtsite/
is already part of the Local Archive Path, it's placed within the link URL but outside the MTCollectedArchive
tag. Also note that it's OK that the code above is broken up onto three lines, because MTCollectedArchive
ignores leading and trailing whitespace. Finally, note the use of the dirify
global attribute, which will turn the group name into an allowable filename. But dirify
isn't used on the second instance of MTCollectedGroup
, because that's just the link text you're displaying to the user.
So, what exactly will happen here? The code above will produce the following output on this index page:
<p><a href="/mtsite/cite_archive/applecom.html">apple.com</a> <p><a href="/mtsite/cite_archive/mtsixapartcom.html">mt.sixapart.com</a> <p><a href="/mtsite/cite_archive/nytimescom.html">nytimes.com</a> <p><a href="/mtsite/cite_archive/searchcpanorg.html">search.cpan.org</a>
And the following files will be created on your server:
/www/mydomain/mtsite/cite_archive/applecom.html /www/mydomain/mtsite/cite_archive/mtsixapartcom.html /www/mydomain/mtsite/cite_archive/nytimescom.html /www/mydomain/mtsite/cite_archive/searchcpanorg.html
As for what those pages might actually contain, please see the full Usage Examples below.
The tag takes the following attributes:
- template="template_name" (required)
The name of a Movable Type template. You should create this as either a Template Module or an Index Template that's set not to "Rebuild automatically when rebuilding index templates."MTCollectedArchive
will load this template and build it once for each grouping. - create_directories="1" (optional)
By default,MTCollectedArchive
will not create directories that do not already exist in the path to the files it creates. Passcreate_directories="1"
if you want any missing directories to be automatically created. This is basically a "Yes, I know what I'm doing" attributea precaution so that you don't accidentally create dozens of unwanted directories on your server. - omit_filename="1" (optional)
If you're using the group name as a directory name, you might not want to include the actual filename in the link you generate. For instance, you might want to link to/mydomain/mtsite/applecom/
instead of/mydomain/mtsite/applecom/index.html
. If you passomit_filename="1"
,MTCollectedArchive
will still use the filename to create the file, but will display only the path portion of its contents (including a trailing slash) on the template.
Usage Examples
- Listing the Links in Each Entry
Objective: Below each entry, display all the links contained in the entry.
<MTEntries> <MTCollect tags="a"> <p><$MTEntryTitle$><br> <MTCollectThis show="1"> <$MTEntryBody$> </MTCollectThis> <MTIfCollected tags="a"> <p>Links in this entry: <MTCollected tags="a" sort_by="content"> <br><a href="<$MTCollectedAttr attr="href"$>"><$MTCollectedContent$></a> </MTCollected> </MTIfCollected> </MTCollect> </MTEntries>
- Footnoting Links
Objective: Below each entry, display a numbered list of the URLs linked to in the entry, and insert the corresponding footnote numbers, in the format
[1]
,[2]
,[3]
... into the entry body.<MTEntries> <MTCollect tags="a"> <p><$MTEntryTitle$><br> <MTCollectThis show="1" a="/\[[N]\]"> <$MTEntryBody$> </MTCollectThis> <MTIfCollected tags="a"> <p>Notes: <MTCollected tags="a"> <br><$MTCollectedIndex$>) <$MTCollectedAttr attr="href"$> </MTCollected> </MTIfCollected> </MTCollect> </MTEntries>
- Stripping HTML For Plain-Text Presentation
Objective: Display an entry stripped of all HTML tags, replacing certain tags with appropriate non-HTML formatting. This example wraps italicized text in asterisks (so
I <i>love</i> plugins
becomesI *love* plugins
), changes each <hr> to a line of dashes, and replaces each image with a string containing the image's path or URL.<MTEntries> <MTCollect tags="img,i,hr"> <MTCollectThis show="1" remove_html="1" img="\[IMAGE: [src]\]" i="*/*" hr="-------------"> <$MTEntryBody$> </MTCollectThis> </MTCollect> </MTEntries>
Note that the actual stripping of HTML is done by MT's built-in
remove_html
global attribute, not by the Collect plugin itself. - Listing Recent Links
Objective: On a sidebar or elsewhere in your navigation, display the URLs you've most recently linked to in your entries.
<MTCollect tags="a"> <MTEntries lastn="20"> <MTCollectThis> <$MTEntryBody$> </MTCollectThis> </MTEntries> Recent Links:<br> <MTCollected tags="a" lastn="10" show_local="1"> <a href="<$MTCollectedAttr attr="href"$>"><$MTCollectedAttr attr="href"$></a><br> </MTCollected> </MTCollect>
The example above uses the URL as the text of the link. If that's too long for the location where you want to put it, you could use the linked site as the text:
<MTCollect tags="a" urls="href"> <MTEntries lastn="20"> <MTCollectThis> <$MTEntryBody$> </MTCollectThis> </MTEntries> Recent Links:<br> <MTCollected tags="a" lastn="10"> <a href="<$MTCollectedAttr attr="href"$>"><$MTCollectedSite$></a><br> </MTCollected> </MTCollect>
Note the inclusion of
urls="href"
in theMTCollect
tag, which is necessary to get the plugin to collect the site information. - Creating a Glossary of Acronyms
Objective: Create a glossary listing the definitions of the acronyms that appear in your entries.
HTML's
acronym
tag is intended for marking up acronyms with their definitions, like so:<acronym title="World Wide Web">WWW</acronym>
If the acronyms in your entries are tagged like this, you can create a glossary with the following code:
<MTCollect tags="acronym"> <MTEntries lastn="999"> <MTCollectThis> <$MTEntryBody$> </MTCollectThis> </MTEntries> <MTCollected tags="acronym" sort_by="content" skip_dupes="1"> <$MTCollectedContent$>: <$MTCollectedAttr attr="title"$><br> </MTCollected> </MTCollect>
Note the use of the
skip_dupes
attribute to omit duplicate acronyms from the listing. - Archiving Entries by Linked Site
Objective: Create a set of archive pages, each of which lists all the entries that link to pages on a particular site.
This code goes on the index template:
<MTCollect tags="a" urls="href"> <MTEntries lastn="999">> <MTCollectThis> <$MTEntryBody$> </MTCollectThis> </MTEntries> <MTCollected tags="a" group_by="site" sort_by="count" sort_order="descend" min_count="5"> <a href="/mttest/<MTCollectedArchive template="archive_links"> links_archive/<$MTCollectedGroup dirify="1">.html </MTCollectedArchive>"><$MTCollectedGroup$></a> (<$MTCollectedGroupCount$>)<br> </MTCollected> </MTCollect>
And this code goes into a template module named
archive_links
:<p>Entries linking to <$MTCollectedGroup$><br> (<$MTCollectedGroupCount$> entries) <MTEntries> <p><a href="<$MTEntryPermalink$>"><$MTEntryTitle$></a> (<$MTEntryDate format="%m/%d/%Y"$>) </MTEntries>
The code above will create an archive page for any site you've linked to at least 5 times (because of the
min_count="5"
attribute). It will create pages in the directorylinks_archive
within your local archive path. Each archive page will display the titles of the entries linking to a particular site, with a link to each entry.What if, beneath each entry shown on the archive page, you want to list the actual links to the site in question? That's where
MTCollectedEntryTags
comes in. You could use the following code in the template module:<p>Entries linking to <$MTCollectedGroup$><br> (<$MTCollectedGroupCount$> entries) <MTEntries> <p><a href="<$MTEntryPermalink$>"><$MTEntryTitle$></a> (<$MTEntryDate format="%m/%d/%Y"$>) <ul> <MTCollectedEntryTags tags="a"> <li><a href="<$MTCollectedAttr attr="href"$>"><$MTCollectedContent$></a></li> </MTCollectedEntryTags> </ul> </MTEntries>
- Archiving Entries by Cited Source
Objective: Create a set of archive pages, each of which lists all the entries that cite a particular source, as you've specified with the
cite
tag.HTML's
cite
tag can be used to mark up the names of various sources you're citing in your text, as follows:<cite>Malcolm Lowry</cite>: <a href="http://somewhere.com/page.html">I am somewhat thirsty</a>. Interesting. Perhaps <cite>Wired Magazine</cite> put it best when they said, "Hey, computers are good."
If your entries are consistently marked up in this fashion, you can use the following code to generate archives of entries by cited source. This goes on the index template:<MTCollect tags="cite"> <MTEntries lastn="999">> <MTCollectThis> <$MTEntryBody$> </MTCollectThis> </MTEntries> <MTCollected tags="cite" group_by="content" sort_by="group"> <a href="/mtsite/<MTCollectedArchive template="archive_cite"> cite_archive/<$MTCollectedGroup dirify="1">.html </MTCollectedArchive>"><$MTCollectedGroup$></a> (<$MTCollectedGroupCount$>)<br> </MTCollected> </MTCollect>
And this goes into a template module named
archive_cite
:<p>Entries that cite <$MTCollectedGroup$><br> (<$MTCollectedGroupCount$> entries) <MTEntries> <p><a href="<$MTEntryPermalink$>"><$MTEntryTitle$></a> (<$MTEntryDate format="%m/%d/%Y"$>) </MTEntries>
This will create pages in the directory
cite_archive
within your local archive path. With the example text above, the pages would bemalcolm_lowry.html
andwired_magazine.html
. Each archive page will display the titles of the entries citing a particular source, with a link to each entry. - Archiving Quotations by Source
Objective: Create a set of archive pages, each of which displays all
blockquote
d quotations from a particular source, and links to the entry containing each quotation.The
blockquote
HTML tag takes acite
attribute that can be used to specify the URL from which the quotation is taken. If you're using this attribute in your entries, you can use the following code to generate quotation archives. This goes on the index template:<MTCollect tags="blockquote" urls="cite"> <MTEntries lastn="999">> <MTCollectThis> <$MTEntryBody$> </MTCollectThis> </MTEntries> <MTCollected tags="blockquote" group_by="site" sort_by="group"> <a href="/mtsite/<MTCollectedArchive template="archive_quote"> quote_archive/<$MTCollectedGroup dirify="1">.html </MTCollectedArchive>"><$MTCollectedGroup$></a> (<$MTCollectedGroupCount$>)<br> </MTCollected> </MTCollect>
And this goes into a template module namedarchive_quote
:<p>Quotations from <$MTCollectedGroup$><br> <MTEntries> <p><a href="<$MTEntryPermalink$>"><$MTEntryTitle$></a> (<$MTEntryDate format="%m/%d/%Y"$>) <MTCollectedEntryTags tags="blockquote"> <blockquote cite="<$MTCollectedAttr attr="cite">"><$MTCollectedContent$> <div align="right"><a href="<$MTCollectedAttr attr="cite"$>">Quoted Page</a></div> </blockquote> <hr> </MTCollectedEntryTags> </MTEntries>
Version History
7/12/04 - version 1.2
- Plugin now registers itself with MT 3 interface.
- Added $VERSION variable.
- Conditional container tags are now declared as conditional tags, so they should work with MTElse.
3/1/04 - version 1.18
- All container tags now pass conditions along when building contents, so they'll work outside conditional tags within MTEntries, etc. (Floozle)
7/22/03 - version 1.17
MTIfCollected
now checks for locality of URLs and takesshow_local
attribute. (Jason Mevius)- Fixed warning when
MTCollectThis
encounters an undefined URL value. (Jason Mevius)
7/10/03 - version 1.16
- Added
omit_filename
attribute toMTCollectedArchive
. (Joshua Kaufman)
7/10/03 - version 1.15
MTCollectedArchive
will now create any directories that don't exist in the path to a file it's trying to create, but only if you use the newcreate_directories
attribute. (Joshua Kaufman)
4/4/03 - version 1.1
- Added tags:
MTIfCollectedAttr
,MTIfCollectedContent
,MTIfCollectedSite
- Added
skip_dupes
attribute toMTCollected
(jrimmer) - Site names are now lowercased when collected
- Fixed warning when a listing grouped by site encountered a tag with no site
3/31/03 - version 1.01
- Local links are now skipped correctly in non-grouped
MTCollected
listings (Tarun Nagpal)
3/27/03 - version 1.0 released