Skip to content

Commit 00c423f

Browse files
committed
social previews
1 parent b64a6d2 commit 00c423f

File tree

2 files changed

+18
-32
lines changed

2 files changed

+18
-32
lines changed

examples/official-site/sqlpage/migrations/01_documentation.sql

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -870,7 +870,8 @@ INSERT INTO parameter(component, name, description, type, top_level, optional) S
870870
('sidebar', 'Whether the menu defined by menu_item should be displayed on the left side of the page instead of the top. Introduced in v0.27.', 'BOOLEAN', TRUE, TRUE),
871871
('sidebar_theme', 'Used with sidebar property, It can be set to "dark" to exclusively set the sidebar into dark theme.', 'BOOLEAN', TRUE, TRUE),
872872
('theme', 'Set to "dark" to use a dark theme.', 'TEXT', TRUE, TRUE),
873-
('footer', 'Muted text to display in the footer of the page. This can be used to display a link to the terms and conditions of your application, for instance. By default, shows "Built with SQLPage". Supports links with markdown.', 'TEXT', TRUE, TRUE)
873+
('footer', 'Muted text to display in the footer of the page. This can be used to display a link to the terms and conditions of your application, for instance. By default, shows "Built with SQLPage". Supports links with markdown.', 'TEXT', TRUE, TRUE),
874+
('preview_image', 'The URL of an image to display as a link preview when the page is shared on social media', 'URL', TRUE, TRUE)
874875
) x;
875876

876877
INSERT INTO example(component, description, properties) VALUES
@@ -887,7 +888,7 @@ You see the [page layouts demo](./examples/layouts.sql) for a live example of th
887888
',
888889
json('[{
889890
"component": "shell",
890-
"title": "SQLPage",
891+
"title": "SQLPage: SQL to web pages",
891892
"icon": "database",
892893
"link": "/",
893894
"menu_item": [
@@ -921,7 +922,8 @@ You see the [page layouts demo](./examples/layouts.sql) for a live example of th
921922
],
922923
"layout": "boxed",
923924
"language": "en-US",
924-
"description": "Documentation for the SQLPage low-code web application framework.",
925+
"description": "Go from SQL queries to web applications in an instant.",
926+
"preview_image": "https://sql.datapage.app/sqlpage_cover_image.webp",
925927
"font": "Poppins",
926928
"javascript": [
927929
"https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11/build/highlight.min.js",

sqlpage/templates/shell.handlebars

Lines changed: 13 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -14,34 +14,6 @@
1414
{{/if}}
1515
{{/each}}
1616

17-
{{#if font}}
18-
{{#if (starts_with font "/")}}
19-
<style>
20-
@font-face {
21-
font-family: 'LocalFont';
22-
src: url('{{font}}') format('woff2');
23-
font-weight: normal;
24-
font-style: normal;
25-
}
26-
27-
:root {
28-
--tblr-font-sans-serif: 'LocalFont', Arial, sans-serif;
29-
}
30-
</style>
31-
{{else}}
32-
<link rel="preconnect" href="https://fonts.googleapis.com">
33-
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
34-
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family={{font}}&display=fallback">
35-
<style>
36-
:root {
37-
--tblr-font-sans-serif: '{{font}}',
38-
Arial,
39-
sans-serif;
40-
}
41-
</style>
42-
{{/if}}
43-
{{/if}}
44-
4517
<script src="{{static_path 'sqlpage.js'}}" defer nonce="{{@csp_nonce}}"></script>
4618
{{#each (to_array javascript)}}
4719
{{#if this}}
@@ -53,8 +25,20 @@
5325
<script src="{{this}}" type="module" defer nonce="{{@../csp_nonce}}"></script>
5426
{{/if}}
5527
{{/each}}
28+
5629
<meta name="viewport" content="width=device-width, initial-scale=1" />
57-
<meta name="description" content="{{description}}" />
30+
{{#if title}}
31+
<meta property="og:title" content="{{title}}" />
32+
{{/if}}
33+
{{#if description}}
34+
<meta name="description" content="{{description}}" />
35+
<meta property="og:description" content="{{description}}" />
36+
{{/if}}
37+
{{#if preview_image}}
38+
<meta property="og:image" content="{{preview_image}}" />
39+
<meta name="twitter:image" content="{{preview_image}}" />
40+
{{/if}}
41+
5842
{{#if norobot}}
5943
<meta name="robots" content="noindex,nofollow">
6044
{{/if}}

0 commit comments

Comments
 (0)