Fragments
Overview
A HyperTemplates fragment is an HTML DocumentFragment. Generally speaking, a HyperTemplates layout is an HTML fragment template with at least one HyperTemplates attribute, but this is not a hard requirement.
HyperTemplates fragments are the most useful building block in the HyperTemplates templating system.
Example
This example shows a simple HyperTemplates fragment.
1<!DOCTYPE html>
2<html lang='en-US'>
3 <head>
4 <meta charset='utf-8'>
5 <title ht-content='page.title'></title>
6 <meta name='description' ht-attrs='content:page.description,site.description'>
7 </head>
8 <body>
9 <header>
10 <h1 ht-content='page.title'>Placeholder title</h1>
11 </header>
12 <article id='article' ht-content='markdown:page.content'></article>
13 <footer>
14 <p>© 2024 HyperTemplates</p>
15 </footer>
16 </body>
17</html>
Specification
Valid HTML
Fragments must be valid HTML DocumentFragment.
Fragments must not contain <html>, <head>, or <body> elements.
From a practical perspective a HyperTemplates fragment a file containing valid HTML with at least one template attribute.
To learn more about how to develop HyperTemplates fragments, please visit the HyperTemplates attribute reference.