Skip to content

Commit da1d703

Browse files
committed
new "footer" component for pages
1 parent 67c3d50 commit da1d703

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

sqlpage/templates/shell.handlebars

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
{{#if refresh}}
2525
<meta http-equiv="refresh" content="{{refresh}}">
2626
{{/if}}
27+
<meta name="generator" content="SQLPage"/>
2728
</head>
2829

2930
<body class="layout-boxed">
@@ -69,5 +70,13 @@
6970
{{~#each_row~}}{{~/each_row~}}
7071
</main>
7172
</div>
73+
<div class="w-100 text-center fs-6 my-2 text-secondary">
74+
{{#if footer}}
75+
{{{markdown footer}}}
76+
{{else}}
77+
<!-- You can change this footer using the 'footer' parameter of the 'shell' component -->
78+
Built with <a class="text-reset" href="https://sql.ophir.dev" title="SQLPage v{{buildinfo 'CARGO_PKG_VERSION'}}">SQLPage</a>
79+
{{/if}}
80+
</div>
7281
</body>
7382
</html>

src/templates.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,15 @@ impl AllTemplates {
234234
);
235235
handlebars.register_helper("markdown", Box::new(markdown_helper));
236236

237+
handlebars_helper!(buildinfo_helper: |x: str|
238+
match x {
239+
"CARGO_PKG_NAME" => env!("CARGO_PKG_NAME"),
240+
"CARGO_PKG_VERSION" => env!("CARGO_PKG_VERSION"),
241+
_ => "!!unknown buildinfo key!!"
242+
}
243+
);
244+
handlebars.register_helper("buildinfo", Box::new(buildinfo_helper));
245+
237246
let mut this = Self {
238247
handlebars,
239248
split_templates: FileCache::new(),

0 commit comments

Comments
 (0)