This document provides an overview of the differences between
static and dynamic content, how ExSite manages these, and various
tricks you can use to mix and match them.
content is published to regular files on your server and handled using
the simplest methods available to the web server. The advantages
of static content are:
- it is the fastest and most efficient way to deliver content
- it does not require any code to execute or any databases to be accessed, which makes it the most secure way to deliver content
- it uses simple, clean URLs to address the content
- it takes best advantage of web caching systems, which further boosts performance
- it is compatible with every type of webserver technology
However, it also has the following disadvantages:
- it must be republished when it changes, or your viewers will not see the updates
- it cannot display differently to different viewers, depending on their login status or other factors
content is generated for you at the time you request the page.
The document you view exists only for you at that moment;
if viewed by someone else at the same time, or by you at a
slightly different time, you could get something different.
Dynamic content is good for:
- pages whose content changes too quickly to easily republish it
- pages that display viewer-specific content (eg. user profiles)
- pages that display content conditionally (ie. member-only pages)
However, dynamic content has the following disadvantages:
is resource-intensive compared to static pages. That means the
number of dynamic pages your server can display per second will
generally be much less than the number of static pages. This can
be especially important if you are swamped with traffic, or generating
thousands of dynamic page views for robots or other automated agents
that you don't really care about.
- dynamic pages execute code on
your server, and can read from and write to your database. If
your website has any security problems, dynamic pages is where those
problems will be exposed.
- in many typical default webserving
configurations, the index page of a website is presumed to be a static
page (eg. "index.html"). That means there are some places where
it is impractical or more difficult to use dynamic pages than others.
page can declare whether it is static or dynamic. This determines
the default view of the page, for example the initial view of the page
when you first navigate to it from a menu.
is the most efficient method, but some pages are best set to a dynamic
view, because their contents change rapidly or unpredictably. For
example, forums can be updated at any time by readers, so a dynamic
view works best to display the current comments.
Private (member-only) pages are dynamic by default, because they display different content depending on who is viewing them.
Switching from static to dynamic
in ExSite are not either static or dynamic, but can switch between
these modes as needed. The static URL to a page will be something
whereas the dynamic URL will be something like:
available, the static representation is used as the default page view
because it is more efficient, but it will automatically switch to
dynamic if necessary.
a few tricks for getting some of the benefits of a dynamic page, while
using a published static HTML file that is served like a static page.
DHTML (client-side dynamic content)
allowing for a small amount of flexibility in varying what you display
to your viewer. One example in ExSite is the Login plug-in, which
detects whether you are logged in or not, and displays either a login
or logout link. This allows normal static pages to adjust their
displayed functions depending on the viewer, without actually executing
any server code or connecting to your database.
method uses automatic republishing tools to regenerate a static page at
regular intervals. That allows the static page to be updated with
current content, without the webmaster having to log in and manually
republish every time something new happens. This method is good
for general content that changes frequently, but will not work for
user-specific content that changes for each viewer.
Check out the article on Scehduled Publishing for more information.
This method uses AJAX to dynamically fetch
certain page elements and insert them into a published static page.
For example, a static home page could include an AJAX-generated
index of the most recent user comments from the forums. Such
pages are partially static and partially dynamic. Robots will
generally ignore the AJAX calls, and get only a static page.
ExSite allows you to automatically run any plug-in in AJAX mode, with a
minor change to the plug-in tag. See the article on ((Working with
Plug-ins)) for more information on using AJAX.
Similarly, there are some tricks you can use to make it appear that a page is static, when in fact it is fully dynamic:
this method, the page indexing information is passed as path data
rather than query data in the URL. A dynamic page URL like
will become something like:
resembles the style of URL used for static pages, and may get you some
of the caching or SEO benefits reserved for static pages. A sharp
eye will still spot the "/cgi/page.cgi" part of the address, and
recognize that as characteristic of dynamic pages. You can use
Apache's mod_rewrite tools to edit this out of the URLs, if that
Note that clean URLs are
slightly more costly to use, because they require more database lookups
to find the page than the default URL style.
To get clean URLs for your basic pages, use the following configuration setting in your exsite.conf
page.dyn_url_type = path
Some plug-ins can also support clean URLs. You may need to add
additional configurations to extend clean URLs into these plugins. For
example, to also get clean URLs on your e-Zines and articles, add the
following configuration parameter to your Zine.conf file:
link_style = path
Prepublishing Dynamic Pages
With this method, all
pages are published to disk, whether static or dynamic. However, for
the dynamic pages, the dynamic elements of the page (namely the
plug-ins) are left unresolved. In the published page's HTML file,
they appear as CMS tags. If the page is viewed as a normal static
file, those tags are treated as HTML comments and they do nothing - the
plug-in area will appear blank. If, however, the page is viewed
using the clean URL method (above), ie.
ExSite will display the published HTML file, and dynamically expand the
remaining plug-ins on the page. Mod_rewrite can be used to
translate the "static" URL http://foobar.com/somepage.html to the
dynamic URL noted above.
If any of the pages
are truly static, they will still display correctly if they are
translated to the dynamic URL. That means it is quite safe to
rewrite all URLs to the dynamic form.
To prepublish your dynamic pages, set the following configuration setting in your exsite.conf
page.prepublish_dynamic = 1
To have ExSite always link to the static URL for these dynamic pages, you should also set:
page.static_urls = 1
but if you do this you will need to add some Apache mod_rewrite
instructions to run all static page URLs though page.cgi, for example:
http:://www.foo.com/page.html -> rewrite to http:://www.foo.com/cgi/page.cgi/page.html
Redirecting to Dynamic Pages
This method publishes a dummy static page that consists of nothing more
than a meta-refresh instruction that redirects the browser to the
actual dynamic page. Links and menus will point to the dummy static
The effect for regular visitors is that they see the URL of the static
dummy page in their address bar, but they receive the content of the
full dynamic page. Robots will crawl the efficient dummy static page,
rather than tax your server with requests for dynamic pages. (Smart
robots will see the meta-refresh instruction and come back later for
the dynamic page, but dumb robots may just leave it at that and stop
pestering your website.)
To publish dynamic pages to a meta-refresh instruction, add the following configuration setting to your exsite.conf
page.redirect_dynamic = 1
ExSite can use full or relative URLs, and
the choice can be different on static and dynamic pages. The default
configuration settings are:
page.relative_static_url = 0
page.relative_dynamic_url = 1
Dynamic Content Objects
We have been discussing page views above, but it is also possible
to view particular images or files (non-HTML pages) either dynamically
or statically. If a content object is published to disk, it will
have a normal URL such as:
(The specifics of the URL will vary depending on whether the file is placed in a library, template, or normal page.)
The same content object can also be viewed dynamically, eg:
The advantage of dynamic content views is that they can be restricted to certain users (eg. members-only documents).