Labels

accessibility (2) ADF (1) archiver (3) cmu (1) contributor (13) cookie (1) DAM (3) date (3) download (3) dynamic list (4) ephox (5) fatwire (1) fck (1) filters (1) folders (4) headers (2) IBR (3) ImageAlchemy (3) java (4) javascript (2) layout/template (4) link (6) locale (2) multilingual (1) rendition (3) replicator (4) rules (1) schema (1) search (11) sites (1) sitestudio (24) ssp/sspu (5) SSUrlFieldName (2) stellent (4) timezone (1) urm (1) weblogic (1) workflow (2)

Tuesday 30 August 2011

Static Publish of Query String URLs & Dynamic Pages

The Site Studio Publisher (SSP) and the pre-11g versions (SSPU) are tools that take your virtual dynamic SiteStudio website and convert it into a bunch of fair-dinkum files. This does mean that all "dynamic" functionality is lost, including any query string variables in the URL. But there actually is a way for SSP to produce multiple pages from a URL query string.


URL query strings are often used in dynamic sites to change the output of a single page. For example, going to page two of a dynamic list by adding "?page=2" to the URL is a pretty common thing to do. But that URL doesn't work on a statically published site because, well, the URL needs to point to a static file! SSP will sensibly remove the question mark and everything after it, which unfortunately means the list is only ever one page in one file. Therefore, site designers need to avoid putting variables in their URL if they are going to statically publish their site.

For example these two pages http://mysite.com/somepage?myvar=foo
and http://mysite.com/somepage?myvar=bar will simply become the one page http://mysite.com/somepage.html and the query string is lost. The contents of the page will either be about foo or bar, depending on which arrived last.

But there are times when you need to publish multiple pages, like the "go to page 2" example. To make this work the query string needs to be converted into a file name and fortunately SSP can do that. The way to make your variables work is to insert the phrase "NextRow" into the variable name* like this:
http://mysite.com/somepage?myvarNextRow=foo
http://mysite.com/somepage?myvarNextRow=bar

The generated URLs will look like this:
http://mysite.com/somepage_myvarNextRow_foo.html
http://mysite.com/somepage_myvarNextRow_bar.html

It's a bit ugly** but it should work for any number of variables. Any other query string variables in the URL will be discarded (after they affect the page.)

* Note that SSP can be configured to honour other variable names using the "Friendly Url Parameters" list. (SSPU does not have this option.)

** Also note that a transform-content filter can be used to rename the files and remove the redundant "NextRow" string.

No comments:

Post a Comment