From dea2daac926be3014375ae807bd4407a38cbed70 Mon Sep 17 00:00:00 2001 From: Ophir Lojkine Date: Sat, 28 Nov 2026 23:46:30 +0000 Subject: [PATCH] Redirect external blog permalinks to the published article --- examples/official-site/blog.sql | 5 ++++- examples/official-site/test.hurl | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/examples/official-site/blog.sql b/examples/official-site/blog.sql index 781e4fa13..9687f4fce 100644 --- a/examples/official-site/blog.sql +++ b/examples/official-site/blog.sql @@ -1,6 +1,9 @@ select 'redirect' as component, '/blog.sql' as link where ($post IS NULL AND sqlpage.path() <> '/blog.sql') OR ($post IS NOT NULL AND NOT EXISTS (SELECT 1 FROM blog_posts WHERE title = $post)); +select 'redirect' as component, external_url as link +from blog_posts where title = $post and external_url is not null; + select 'shell-docs' as component, coalesce($post || ' - ', '') || 'SQLPage Blog' as title; SELECT 'text' AS component, @@ -19,4 +22,4 @@ SELECT title, CASE WHEN external_url IS NULL THEN json_object('post', title) ELSE NULL END ) AS link FROM blog_posts -ORDER BY created_at DESC; \ No newline at end of file +ORDER BY created_at DESC; diff --git a/examples/official-site/test.hurl b/examples/official-site/test.hurl index 99061a770..6cc606187 100644 --- a/examples/official-site/test.hurl +++ b/examples/official-site/test.hurl @@ -51,6 +51,11 @@ HTTP 200 [Asserts] xpath "normalize-space(//main//h3/a[@href='/functions.sql?function=variables'])" == "variables([method])" +GET http://localhost:8080/blog.sql?post=Repeating+yourself+thrice+won%27t+make+you+a+3X+developer +HTTP 302 +[Asserts] +header "Location" == "https://yrashk.medium.com/repeating-yourself-thrice-doesnt-turn-you-into-a-3x-developer-a778495229c0" + GET http://localhost:8080/functions.sql?function=url_encode HTTP 200 [Asserts]