Skip to content

Commit f60ba21

Browse files
committed
shell-empty docs clarification
1 parent ac7bc97 commit f60ba21

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

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

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1534,21 +1534,20 @@ SELECT
15341534
```
15351535
', NULL),
15361536
('shell', '
1537-
### A page without a shell
1538-
SQLPage provides the `shell-empty` component to create a page without a shell.
1539-
In this case, the `<html>` and `<body>` tags are not generated, and the components are rendered directly in the page
1540-
without any styling, navigation bar, footer, or dynamic content.
1541-
Any component whose name starts with `shell` will be considered as a shell component,
1542-
so you can also [create your own shell component](custom_components.sql#custom-shell).
1537+
### Returning custom HTML, XML, plain text, or other formats
15431538
1544-
This is particularly useful when creating a [RESTful API](https://en.wikipedia.org/wiki/REST) with SQLPage.
1545-
Typically, the data returned to the client is not formatted in HTML but rather in JSON or XML.
1546-
With the `shell-empty` component, you simply need to construct the formatted data and assign it to the contents property.
1539+
Use `shell-empty` to opt out of SQLPage''s component system and return raw data directly.
15471540
1548-
Remember to use the [http_header](component.sql?component=http%5Fheader) component beforehand to inform the client about the format of the data being sent.
1541+
By default, SQLPage wraps all your content in a complete HTML page with navigation and styling.
1542+
The `shell-empty` component tells SQLPage to skip this HTML wrapper and return only the raw content you specify.
15491543
1550-
In the example below, SQLPage returns data formatted in XML.
1551-
The correct [MIME](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/MIME_types/Common_types) type should be `application/xml`.
1544+
Use it to create endpoints that return things like
1545+
- XML (for JSON, use the [json](?component=json) component)
1546+
- plain text or markdown content (for instance for consumption by LLMs)
1547+
- a custom data format you need
1548+
1549+
When using `shell-empty`, you should use the [http_header](component.sql?component=http%5Fheader) component first
1550+
to set the correct [content type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type) (like `application/json` or `application/xml`).
15521551
',
15531552
json('[
15541553
{

0 commit comments

Comments
 (0)