4

Here's my problem: I want to build a web site, mostly static but with some dynamic parts (a little blog for news, etc..). My web server can only do static files (it's actually a public dropbox directory!) but I don't want to repeat the layout in every html page!

Now, I see two possible solutions here: either I create an index.htm page that emulates site navigation with JavaScript and AJAX or I create all the different html pages and then somehow import the layout bits with JavaScript..

From you I need ideas and suggestions on how to implement this, which libraries to use, or maybe there exists even something tailored exactly for what I need?

5 Answers 5

2

I would define the site layout in your index.html file, and then use JavaScript and Ajax to load the actual content into a content div on the page. That way your content files (fetched by Ajax) will be more or less plain HTML, with CSS classes defined in index.html. Also, I wouldn't recommend building a blog in pure HTML and JavaScript. It wouldn't be very interactive; no comments, ratings, etc. You could store your blog content in XML and then fetch and display it with Ajax and JavaScript, however.

While on the subject of XML, you could implement all your site content in XML. You should also store the list of pages (for generating navigation) as XML.

Sign up to request clarification or add additional context in comments.

2 Comments

yeah this is sort of what I had in mind. My "blog" was actually more in the line of a news sections, I don't need user interaction. I'll try it.. I'm a bit afraid of all those problems like back/forward browser buttons, how to show it's loading etc.. this website must be easy to use..
Oh ok, good, that's even easier. But I would still represent your content as XML. It's easy to organize and you can define metadata on your posts/pages.
0

Just another one way. You can generate static HTML in your computer and upload result to dropbox. Look at emacs muse.

Comments

0

jQuery allows you to easily load a section of one page into another page. I recommend loading common navigation sections into the different pages, rather than the other way around to avoid back/forward problems. Layout can be done with a separate CSS file rather than with tables to minimize the amount of repeated code. For the blog, you could put each blog entry in a separate file and load each section individually.

However, I would just use something already available. TiddlyWiki, for example, is a self-contained wiki that is all in one file. It's very customizable, and there's already a blog plug-in available for it. You can work on the site on your hard drive or USB drive, and then you can upload it to the web when done. There's nothing more to it.

Comments

0

Have you considered using publishing software on your computer to combine your content with a template, resulting in a set of static pages that you can then upload to the dropbox?

Some options in this regard come to mind:

To handle comments, you can use Disqus. It inserts a complete comment system into your site using just JavaScript.

Comments

0

You can use the Google Closure templates. It's one of the fastest and most versatile javascript templating solutions around.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.