MiniVend now has a complete implementation of a static page building facility. It allows you to build a parallel page tree completely in HTML, and most importantly, keeps track of all of the URLs for you. It means that MiniVend, whether the page on the browser was called dynamically or statically, will call the appropriate page for you. This can mean huge performance gains in catalogs with lots of pages in the browsing structure, for any statically built pages never have to call MiniVend. This improves performance and decreases server load.
You can also use it to build page trees that are scannable by a search engine spider.
As of MiniVend 3.03, to make static page building active, you must set the Static directive to Yes
. This allows you to turn it on or off with a single directive, and is a
change from MiniVend 3.02 and below.
It is invoked when starting the MiniVend server by passing the extra
parameters
-build shop
to the minivend program. MiniVend will scan the entire page structure,
testing each page to see if it has any
dynamic elements. Dynamic elements are those MiniVend tags which depend on user session
status, like the contents of the shopping cart, conditional tests on user
variables, or databases marked as dynamic with the DynamicData directive. If a page has dynamic elements, it will not be built statically.
Some tags which cause static building to fail are:
[cart ...] [if session ...] [perl] [checked ...] [if validcc ...] [salestax] [data ...]* [if value ...] [scratch ...] [default ...] [item_list] [selected ...] [discount] [last_page] [shipping] [finish-order] [lookup ..] [shipping_desc] [frames_on|off] [loop-data ...]* [sql set] [if data ...]* [loop-field ...]* [subtotal] [if discount ...] [sql set] [total_cost] [if items ...] [nitems] [value ...] [if scratch ...] [perl]
* Only if database referenced is dynamic
In addition, if a [search-list]
references dynamic items, it will also prevent a search from being cached
or built statically.
Pages are also searched for static [page scan se=...]
searches, and those searches are built statically if appropriate. They are
placed in the pages scan1.html on up, so don't name any of your pages scan
and then digits if you want to avoid clashing. Search builds recurse one
level down, meaning that if you have a category search that yields more
category searches, they will also be built. You can set the recursion with StaticDepth -- the default is two.
A page marked as an AdminPage or NoCache will not be statically built or cached.
If you wish a page to build statically anyway, despite the presence of
dynamic elements, you can insert [tag flag build][/tag]
at the top of the page. This tells the builder to ignore dynamic elements
and build the page anyway -- it will not override NoCache or AdminPage.
Additionally if you pass a name with [tag flag build]
name[/tag]
, a symbolic link to name will be made in StaticDir. This allows named pages to be reliably found -- otherwise the name of the
page varies with the order the search is found. Commonly you would use
[tag flag build][value mv_searchspec][/tag]
to build a link based on the search string.
Pages are marked for static build in one of three ways:
.build
in the root of the pages directory. MiniVend will use that as the list of
pages to be built on this run.
In addition, you can build all possible on-the-fly pages out of the database if the StaticFly directive is set. This is subject to the StaticPattern as well, so you could build only a portion of the database if you wished. Obviously catalogs that have many thousands of items should be careful about use of StaticFly.
The names of pages that are statically built are maintained in the file
.static
, located in the MiniVend PageDir. This is how MiniVend knows which pages should be referenced with static
URLs.
Any pages included in the list(s)
that fail due to dynamic
elements have their names placed in the file .unbuilt
after the build process.
The StaticDir directive defines the file path to the root of the page structure that will be built. If blank, it will use
the directory static
in the catalog root, which can then be copied to the appropriate place in
HTML document space.
WARNING: Any existing files that are present may be removed from this directory! Do not place normal pages there!
The StaticPath directive defines the URL path to the root of the page structure that will be built. It is relative to HTTP document root, and must obviously be the URL path to StaticDir. Default is /, or DocumentRoot.
The StaticSuffix directive defines the suffix of the files that will be built. The default
is .html
. DOSites might want to make it .htm
, and if you wished to have the files parsed for server side includes you
might use .shtml
.
If you wish to build the catalog pages offline (recommended on servers that are used by multiple catalogs), you can use the command:
start -test -build shop
where shop
is the name of the catalog to be built. (Multiple -build name
directives can be used to build more than one catalog.)