Skip to content

Commit 50d2299

Browse files
committed
tutorials
1 parent 2f9c101 commit 50d2299

File tree

8 files changed

+38
-19
lines changed

8 files changed

+38
-19
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
- Add support for evaluating calls to `coalesce` inside sqlpage functions. This means you can now use `coalesce` inside arguments of sqlpage functions, and it will be evaluated inside sqlpage. For instance, this lets you call `sqlpage.link(coalesce($url, 'https://sql-page.com'))` to create a link that will use the value of `$url` if it is not null, or fallback to `https://sql-page.com` if it is null.
3737
- In the form component, allow the usage of the `value` property in checkboxes and radio buttons. The custom `checked` property still works, but it is now optional.
3838
- Updated the welcome message displayed on the terminal when starting the server to be friendlier and more helpful.
39+
- Display the page footer (by default: `Built with SQLPage`) at the bottom of the page instead of immediately after the main content.
3940

4041
## 0.31.0 (2024-11-24)
4142

Loading
Loading

examples/official-site/your-first-sql-website/index.sql

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,20 @@ SELECT 'alert' as component,
5353
'Watch the introduction video' as link_text;
5454
select 'https://www.youtube.com/watch?v=6D5D10v18b0&list=PLTue_qIAHxActQnLn_tHWZUNXziZTeraB' as link, 'Tutorial video series' as title;
5555

56-
select 'text' as component, sqlpage.read_file_as_text(printf('your-first-sql-website/tutorial-install-%s.md',
57-
case
58-
when $os = 'windows' then 'windows'
59-
when $os = 'macos' then 'macos'
60-
else 'any'
61-
end
62-
)) as contents_md, 'download' as id;
63-
select 'text' as component, sqlpage.read_file_as_text('your-first-sql-website/tutorial.md') as contents_md;
56+
select 'text' as component,
57+
sqlpage.read_file_as_text(
58+
printf('your-first-sql-website/tutorial-install-%s.md',
59+
case
60+
when $os = 'windows' then 'windows'
61+
when $os = 'macos' then 'macos'
62+
else 'any'
63+
end
64+
)
65+
) as contents_md,
66+
true as article,
67+
'download' as id;
68+
69+
select 'text' as component,
70+
sqlpage.read_file_as_text('your-first-sql-website/tutorial.md') as contents_md,
71+
true as article,
72+
'tutorial' as id;

examples/official-site/your-first-sql-website/tutorial-install-any.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
# Download SQLPage: the SQL website framework
1+
# Download SQLPage (the SQL website builder)
22

3-
SQLPage is a small executable file that will take requests to your website, execute the SQL files you write,
3+
SQLPage is a small single-file program that will
4+
execute the SQL files you write,
45
and render the database responses as nice web pages.
56

7+
If you have already downloaded SQLPage,
8+
you can skip this step and [start writing your website](#tutorial).
9+
610
[Download the latest SQLPage](https://github.com/sqlpage/SQLPage/releases) for your operating system.
711
In the _release assets_ section, you will find files named `sqlpage-windows.zip`, `sqlpage-linux.tgz`, and `sqlpage-macos.tgz`.
812
Download the one that corresponds to your operating system, and extract the executable file from the archive.

examples/official-site/your-first-sql-website/tutorial.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ In the rest of this tutorial, we will call this folder the **root folder** of yo
99

1010
![screenshot for the sql website setup on linux](first-sql-website-launch.png)
1111

12-
You should see a message in your terminal that includes the sentence `accessible from the network, and locally on http://localhost:8080`
12+
You should see a message in your terminal telling you that SQLPage is ready, and giving you the address of your website.
1313

1414
You can open your website locally by visiting [`http://localhost:8080`](http://localhost:8080)
1515

@@ -20,19 +20,24 @@ SQLPage should have automatically created a folder called `sqlpage` with a SQLit
2020
In the root folder of your SQLPage website, create a new SQL file called `index.sql`.
2121
Open it in a text editor that supports SQL syntax highlighting (I recommend [VSCode](https://code.visualstudio.com/)).
2222

23-
The `index.sql` file will be executed every time a visitor opens your website's home page.
24-
You can use it to retrieve data from your database and define how it should be displayed to your visitors.
23+
The `index.sql` file will be executed every time a visitor opens your website's home page, and the results will be displayed to the visitor
24+
using the components you specify in the file.
2525

26-
As an example, let's start with a simple `index.sql` that displays a list of popular websites:
26+
Let's start with a simple `index.sql` that displays a list of popular websites:
2727

2828
```sql
29-
SELECT 'list' AS component, 'Popular websites' AS title;
29+
SELECT 'list' AS component,
30+
'Popular websites' AS title;
3031

31-
SELECT 'Hello' AS title, 'world' AS description, 'https://wikipedia.org' AS link;
32+
SELECT 'Hello' AS title,
33+
'world' AS description,
34+
'https://wikipedia.org' AS link;
3235
```
3336

37+
![screenshot of the first sql website](hello-world.png)
38+
3439
The first line of the file defines the component that will be used to display the data, and properties of that component.
35-
In this case, we use the [`list` component](/documentation.sql?component=list#component) to display a list of items.
40+
In this case, we use the [`list` component](/component.sql?component=list) to display a list of items.
3641
The second line defines the data that will populate the component.
3742
All the components you can use and their properties are documented in [SQLPage's online documentation](https://sql-page.com/documentation.sql).
3843

sqlpage/templates/shell.handlebars

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@
210210
{{/if}}
211211
{{/if}}
212212
<div class="page-wrapper">
213-
<main class="page-body container-xl px-md-5 px-sm-3 {{#if fixed_top_menu}}mt-5{{#unless (eq layout 'boxed')}} pt-5{{/unless}}{{else}} mt-3{{/if}}" id="sqlpage_main_wrapper">
213+
<main class="page-body container-xl flex-grow-1 px-md-5 px-sm-3 {{#if fixed_top_menu}}mt-5{{#unless (eq layout 'boxed')}} pt-5{{/unless}}{{else}} mt-3{{/if}}" id="sqlpage_main_wrapper">
214214
{{~#each_row~}}{{~/each_row~}}
215215
</main>
216216

src/webserver/http.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ fn log_welcome_message(config: &AppConfig) {
676676
println!(
677677
"✨ SQLPage v{} is ready! ✨\n\n\
678678
View your website at:\n🔗 {}\n\n\
679-
Create your pages using SQL files in:\n💻 {}\n\n\
679+
Create your pages with SQL files in:\n💻 {}\n\n\
680680
Happy coding! 🚀",
681681
env!("CARGO_PKG_VERSION"),
682682
address_message,

0 commit comments

Comments
 (0)