Pages

Friday, March 06, 2009

Include Page in Static HTML with Expression Web

I have found a satisfactory way to include common menus in my static-HTML web sites. Microsoft Web Expression 2.0 continues the FrontPage tradition and offers Include Page functionality. This does exactly what I was looking for. Expression Web supports webbots and one of them is the Include Page.
In the web page where you want to include external content it will only create a placeholder, a one line of code with a reference to the other file. The line looks like this

<!--webbot bot="Include" TAG="BODY" U-Include="aus_menu.html" -->

So, now, when it comes to this line, the Body contents from aus_menu.html will be included in the current page. When the page is saved, the full HTML will be saved in a file so it is available for offline browsing, too.
This is a great way to handle those common menus and now I can use that in the template, etc. Great.

The only issue I had with this approach was that I assumed that it will include the complete contents of the external file and so I created a text file with only the menu (ul) tag. The page including this did not show anything. After adding the full HTML syntax (html, head, and body tags) the menu appeared. It was taken out of the body tag, so everything works perfectly.

Here are some useful links on this topic:
A useful tip to watch out for is that Include Pages in FrontPage act as block-type HTML elements. This means they can not be inserted in the middle of a text paragraph (inline).

No comments: