Skip to content

Commit

Permalink
improve tab component index
Browse files Browse the repository at this point in the history
  • Loading branch information
lovasoa committed Nov 4, 2024
1 parent efa0b88 commit 8ed6362
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions examples/official-site/component.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- ensure that the component exists and do not render this page if it does not
select 'redirect' as component,
'component_not_found.sql?component=' || sqlpage.url_encode($component) as link
where $component is not null and not exists (select 1 from component where name = $component);
'component_not_found.sql' || coalesce('?component=' || sqlpage.url_encode($component), '') as link
where not exists (select 1 from component where name = $component);

-- This line, at the top of the page, tells web browsers to keep the page locally in cache once they have it.
select 'http_header' as component, 'public, max-age=600, stale-while-revalidate=3600, stale-if-error=86400' as "Cache-Control";
Expand Down
2 changes: 2 additions & 0 deletions examples/official-site/component_not_found.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
select 'http_header' as component, 'noindex' as "X-Robots-Tag";

select 'dynamic' as component, properties FROM example WHERE component = 'shell' LIMIT 1;

select
Expand Down
6 changes: 3 additions & 3 deletions examples/official-site/sqlpage/migrations/13_tab.sql
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ View the [dynamic tabs example](examples/tabs.sql).
JSON(
'[
{ "component": "tab" },
{ "title": "My First tab", "active": true },
{ "title": "This is tab two" },
{ "title": "Third tab is crazy" }
{ "title": "This tab does not exist", "active": true },
{ "title": "I am not a true tab" },
{ "title": "Do not click here" }
]'
)
),
Expand Down

0 comments on commit 8ed6362

Please sign in to comment.