It's a common thruth that sharing content is better than duplicating it. Usually, almost all pages of a given website share common layout, stylesheets, scripts and background images. Images, scripts and stylesheets can be (and are in most cases) extracted into separate files which are separatelly cached so that the client does not have to download exactly same bytes hundreeds of times. What about common layout? Unfortunatelly not!
Once W3C proposed a solution: XSLT templates which can be attached to an XHTML file as an outer stylesheet. Unfortunatelly they are even more clumsy, overengeneered and unhuman(readable) than XHTML2, so virtually nobody used them. XHTML2 never took off and was superseded by lightweight HTML5. It's time to replace XSLT by a lightweight solution.
|The document||The template|
<html wrapper="/template/common"> <head> <title>Contacts</title> <blob id="alternate-languages"> <li><a href="?lang=ru">ru</a> <li><a href="?lang=de">de</a> </blob> </head> <dl> <dt>Tel:</dt> +49 11223344 <dt>E-Mail:</dt> firstname.lastname@example.org </dl> ... </html>
<html> <head> <link rel="stylesheet" href="/style/theme.css"/> ... </head> <nav> ... </nav> <aside> <ul> <<alternate-languages>> <ul> </aside> <<body>> </html>