Wandering Thoughts archives

2014-03-23

Differences in URL and site layout between static and dynamic websites

One of the big but subtle differences between a statically rendered site and a dynamically rendered one is simply how you design the URL structure for both of them. One example here is dynamically rendered versus statically rendered blogs.

Broadly speaking, in a statically rendered site you want to have a minimum number of URLs and for each chunk of core content to appear in a relatively minimal number of places, because you have to pre-generate every URL. The more you let content and URLs propagate, the more pages you have to re-render any time you change something (or simply in general), even if they contain mostly redundant information or may never be requested or both. This is going to drive you towards very simple site layouts; in a blog you might have only the individual entries, a front page with recent entries, and then a relatively simple scheme for archives.

In a dynamically rendered site more URLs are almost free and so you often casually grow URLs and even entire URL hierarchies that offer alternative ways of accessing your core content. After all, often all you need to procedurally generate an entire new URL hierarchy is a single chunk of parameterized code (and 'pagination' of large results is often provided for free by your framework, adding more URLs). Provided that this generation is reasonably efficient you might as well create as many ways of accessing your core content as you can think of. On a blog you might support looking at things by any combination of date, category, tag, author, and so on. All you need is some dispatch rules and some lookup filtering.

(You need to create the same core content in both static and dynamic sites; the difference is how many URLs it is visible under.)

The corollary of this is that you may not have a very happy time if you try to go from a dynamic site to a static site while keeping more or less the same URL structure. In a shift like this you probably want to rethink how things are indexed, which basically means rethinking the overall site design and URL structure.

(The corollary to the corollary is that if you're not sure whether you're going to wind up generating things statically or dynamically you should start out by designing your site as a static site, with a URL layout that works for that. As a bonus you'll likely get a simpler, more focused URL structure.)

web/StaticVsDynamicSiteLayout written at 02:13:27; Add Comment


Page tools: See As Normal.
Search:
Login: Password:
Atom Syndication: Recent Pages, Recent Comments.

This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.