Proposal:Pluggable Publishing Profiles

From Movable Type

Abstract

Movable Type 4.1.5 offers a re-imagined way to select how a user is to select how each file on their system gets published. This proposal will make that system extensible by developers allowing plugins to define to much greater detail how to optimize publishing for their site.

Image:Pub-Profiles.png

How it works

The gist is to pass each file through a simple callback to see how it should be published and to return a constant that tells MT what to do.

Example

   publishing_profiles:
       my_profile:
           label: Dynamic Feeds
           description: Publish everything statically except files that end with a .xml file extension.
           handler: $MyPlugin::MyPlugin::Profiles::profile

Then the following code (a total approximation of course).

   package MyPlugin::Profiles;
   
   sub profile {
     my $app =  shift;
     my ($tmpl, $fileinfo) = @_;
     if ($fileinfo->output_file =~ /xml|rss|atom|rdf$/) {
       return MT::Profiles::DYNAMIC;
     }
     return MT::Profiles::STATIC;
   }