English 中文(简体)
What is a good templating solution for the creation of simple static websites?
原标题:
  • 时间:2010-02-08 04:56:14
  •  标签:
  • templating

I want to streamline the process by which I create static websites.

I want to avoid having to do multiple editing operations when I have to change one page element, like the text or image in a footer.

I want to be able to use my tool on a local computer, in order to upload the resulting structure to my server.

I don t want to use a tool that is required to reside on a server. I simply don t want a php solution when I don t need it s power or want it s overhead.

I certainly don t want to use a CMS.

Ideally, I would like the solution to be well-documented.

I ve looked at the perl template toolkit. But is capable of so much, that it s body of documentation effectively hides the simple tasks that I want to accomplish.

I ve also looked at webgen, but the same problem exists. It can do so much that it is difficult to set up for the simple task of creating a small static website. Again, the documentation is very detailed, but unhelpful for the creation of simple sites.

What solutions do other developers use ?

问题回答

The most obvious solution is to use an editor like Dreamweaver that has templating built in. The result of template + page content is a single static page that s served as plain HTML. The page processing is done at design time, not when the page is served. It s been a number of years since I ve used DW but I d guess it still offers this feature. Frontpage might support this as well, but I ve barely used it so I couldn t tell you.

Another, more creative solution would be to make a scripted site using Perl or something and then mirror it with wget. The mirrored copy will just contain the HTML that was generated from your scripted pages. That way, you get (some of) the flexibility of scripting while still getting the performance and simplicity of serving static HTML.

It all depends on the language you re using... HTML is prolly not the best, but if you re using ASP.NET then you can use Masterpages. If you re using PHP or ASP you could include headers and footers, as well as navigation and other persistent content.

This is not so much a tool as it is a concept.

If you don t want to use any server side solutions and you don t want to use ASP.NET then your only real option is iFrames but they do have some issues with SEO so I would stay away from them.

Honestly, I would suggest ASP.NET. Just use Mono. It is open source and can run on Apache and a couple other *nix server types. It will allow you to use user controls and masterpages to manage your code and reduce code duplication. I know that will create some server side overhead but .NET does compile its code on the server. Also, it wouldn t be doing much on the code side just putting your html files together which something is going to have to do regardless. That would mean pretty minimal processing on the server.

I know you said no server-sided solutions but mod_layout for apache does what you want pretty easily.

http://freshmeat.net/projects/mod_layout/

Adobe s Contribute tool can let you do this too -- it s kind of like Dreamweaver for people who don t want to know about HTML. Perfect for the situation where a company chooses someone to maintain a website that has never done anything on the web beyond casual surfing (why does this happen so much?). It uses FTP/SFTP in the background.

That said, if you have any developer bones in you, you will be highly annoyed by the way it shields you from the code. Also, getting any help from Adobe is a lost cause.

There is Ristretto project: https://github.com/ViliamKopecky/Ristretto. It s designed for simple creation of HTML files. It uses templating from Nette Framework (PHP), but is produces plain HTML, so you don t need PHP on server.

It also allows you to keep variables aside from files in Neon format (Yaml-like).





相关问题
在Jenkins Templating引擎实施版本

我们正计划利用JTE(Jenkins Templating的发动机)在我们org建造管道。 有许多管道将使用这一模板。 可能的话,模板的任何改动都会中断......

Templating Html.DisplayFor() in ASP.NET MVC 2

It appears that if you just use Html.DisplayFor(model => model) with no templates for a Details view, the resulting markup will look something like this: <div class="display-label">first ...

Good practices for writing HTML in Javascript

I was wondering about this if people have strong opinions about the best way to generate HTML on the fly, especially with Ajax based applications. Do you just create the HTML code using server side ...

using chain.js for complex templates and images?

I m researching the possible use of the jquery plugin chain.js over other templating systems such as jTemplate. the site is a large online retailer. We have a category page showing a large list of ...

inline markup / templating engine for customer facing CMS

There are many hosted CMS applications that provide you with some sort of inline markup/ templating engine that lets you output things into a page. for example, a hosted cms application lets you edit ...

热门标签