Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

What are your favorite tools for building a static site?

by webfiend (Vicar)
on Dec 15, 2004 at 23:10 UTC ( [id://415215]=perlquestion: print w/replies, xml ) Need Help??

webfiend has asked for the wisdom of the Perl Monks concerning the following question:

I pull myself once again from the murky depths of my daily affairs to bother everybody with an idle question: what tools do you use when building a static Web site? I'm rather fond of WebMake, although I have occasionally felt the urge to use ZenWeb . Heck, I've recently experimented with using Mason as part of my build chain. So what about you?

Okay, you in the back. Your hand isn't raised, but I can see the question you're about to ask. "Why not just dynamically generate all the common elements of your site on the fly?" Because I don't want to, okay? My home site has very little interactivity, and it seems like a waste of CPU to build a site menu on the fly every time somebody loads one of your pages. I like to save the dynamic approach for pages with actual dynamic content - image generation, stuff like that.

  • Comment on What are your favorite tools for building a static site?

Replies are listed 'Best First'.
Re: What are your favorite tools for building a static site?
by Ovid (Cardinal) on Dec 15, 2004 at 23:21 UTC

    Get the Template Toolkit book. Read the first couple of chapters and then skip ahead to the chapter on building static sites. I rebuilt my Web site in just a few hours using it. Now making global changes on the fly is a snap.

    Template Toolkit is ridiculously easy to use, but it's very powerful if you need its advanced features.

    Cheers,
    Ovid

    New address of my CGI Course.

      Thanks for pointing out Template::Toolkit. I had looked at it a while ago, but never got around to really examining it. Now that I've taken a closer look, it will probably do quite nicely for satisfying the little annoyances I'd been experiencing with the other toolkits. WRAPPER is cool, and I can tell that I am going to enjoy FILTER when I get to it.

      Once I figure out how to build my breadcrumb trails and sitemaps, I'll be a happy geek.

        MACRO and BLOCK are also quite useful. You can use them to build recursive template routines. Don't like the word routine here, but it kinda fits.

        builds a string containing the number of "A"'s specified. (dumb example, and it may not work, not tested, but you get the idea) I'm ignoring the argument for/against doing this in template code. The HTML::Template guys will put a hit out on me. :)

        [% MACRO gen_a_list(number_of_as) BLOCK %] [% a_string = "" %] [% IF number_of_as > 0 %] [% a_string = "A" _ gen_a_list(number_of_as - 1) %] [% END %] [% a_string %] [% END %]
        I really enjoy working with TT. I haven't checked out the book yet. Is it decent?

        The book has examples of building breadcrumbs and sitemaps on the fly. You'll like it.

        Cheers,
        Ovid

        New address of my CGI Course.

Re: What are your favorite tools for building a static site?
by Cody Pendant (Prior) on Dec 16, 2004 at 00:37 UTC
    "Why not just dynamically generate all the common elements of your site on the fly?"

    I wasn't going to ask that. I was going to ask, why not use the same tools you use for dynamic for static? Nothing about HTML::Template says it has to be used on the fly. I built a 300-page website with it earlier this year. My boss didn't like a particular item, I said "gimme a sec", edited something, typed "perl rebuild.pl" and three seconds later it was fixed on all 300 pages.



    ($_='kkvvttuubbooppuuiiffssqqffssmmiibbddllffss')
    =~y~b-v~a-z~s; print
Re: What are your favorite tools for building a static site?
by Joost (Canon) on Dec 15, 2004 at 23:27 UTC
    I've used a couple of different template systems but right now my favorite is a simple system based on Template::Toolkit. I used a custom template provider to do the kind of includes I want to do. It looks for includes in the current directory, then the parent dir etc.. Which makes it really easy (for instance) to use a standard index.html file which can include a different header.html file in some subdirectories.

    Read along for code. warning: the following code is probably full of bugs, and could be written better, but it's what I use for my (small) site without any problems. Do with it what you want.

      You don't need a custom Template::Provider just to vary the include path. Changing an existing template object's include path is allowed in TT, and you can do it as often as you like, even in the middle of processing a request.
Re: What are your favorite tools for building a static site?
by kvale (Monsignor) on Dec 15, 2004 at 23:23 UTC
    I built my home site with good ole Emacs in html-mode. But this isn't emacs vs. vi advocacy; any text editor that is HTML aware will do. If you have a number of pages to create, but don't want to use a dynamic template, try a static one instead.

    -Mark

Re: What are your favorite tools for building a static site?
by perrin (Chancellor) on Dec 15, 2004 at 23:28 UTC
    Template Toolkit and ttree for simple stuff, Krang for fancy sites with many contributors.
      The documentation on ttree is incredibly sparse. (For example, there are no examples of actually doing something useful with ttree, only how to set options and configure the app.)

      I never understood where it gets the actual content that will be fed into the templates. If you had a collection of text files for your content, how would you feed them to ttree? The docs just say ttree will "process ... template files," as though that is somehow useful in and of itself (??). Template files without corresponding content files don't seem very interesting to me.

      I just never bothered messing with ttree. Easier to write my own perl scripts and use Template; than to figure out what this script (which I'm sure is useful to those in the know) is supposed to be doing.

      Update: To avoid sounding too much like an ungrateful twit, I should note the Template Toolkit generally ROCKS, and I appreciate the time Andy put into it.

        If you are happy writing your own script and calling TT, there's no need to change.

        The way to add content with ttree is usually to use plugins of some kind for grabbing it from a database or text files or whatever. I would never do that though. I only use it for things where the content is in the files I'm processing, and I just want to add common nav stuff to them via includes.

Re: What are your favorite tools for building a static site?
by inman (Curate) on Dec 16, 2004 at 08:54 UTC
    Macromedia DreamWeaver gets my vote. It is simple to use, WYSIWYG editing, has great support for cascading stylesheets and has it's own FTP engine so that you can edit the files test and deploy within seconds. The tool also allows you to create and use templates so that your site pages retain a common look and feel. When you update the template, any pages that use the template are updated.

    Of course it is a commercial product so the license is quite expensive but if you want the right tools for the job then sometimes you have to pay.

Re: What are your favorite tools for building a static site?
by zakzebrowski (Curate) on Dec 16, 2004 at 01:35 UTC
Re: What are your favorite tools for building a static site?
by eternius (Beadle) on Dec 16, 2004 at 12:16 UTC
    For static content I always use notepad or something similar.
    Proton is freeware and a nice editor too. But I prefer doing some brain artistics with notepad which will keep me from getting bored.
    Recently I am very content with HTMLarea, because its IN the browser and wysiwyg is by far better than using dreamweaver or sth. and do not forget that layout and content are archived with two things: HTML and CSS, never abuse tables for layout :)
    Cheers
Re: What are your favorite tools for building a static site?
by TedPride (Priest) on Dec 16, 2004 at 20:09 UTC
    The trick is to event drive the UPDATES on your web site rather than the VIEWS. The actual complexity of the programming remains more or less the same, since you still have to dynamically generate the pages, but you save quite a bit on processing time and can therefore afford to write working code instead of efficient code, which makes things much easier for you. Templating, for instance, can be quite inefficient if you're working with nested material, but who cares about that if you're only generating each page once per hundreds or thousands of views?

    I generate SSI format pages and include the few bits of actual view-by-view dynamic content. This gives the best of both worlds.

Re: What are your favorite tools for building a static site?
by Anonymous Monk on Dec 16, 2004 at 16:26 UTC
    vi and here documents. But I hardly write webpages. A few pages for my own site, some sysadmin type pages (usually just a bunch of graphs, or some data), and that's about it.
Re: What are your favorite tools for building a static site?
by CountZero (Bishop) on Dec 16, 2004 at 21:55 UTC
    NVU

    CountZero

    "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

Re: What are your favorite tools for building a static site?
by meredith (Friar) on Dec 17, 2004 at 17:41 UTC

    m4 and make -- the poor man's static page builder.

    Since some people mentioned Template Toolkit, you might look at Template::TT2Site for help with this particular usage.

    mhoward - at - hattmoward.org

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://415215]
Approved by Joost
Front-paged by grinder
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2024-04-24 13:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found