SDL: examples: fixup URLs for project subfolder

From 58f8e259d12413b5ee9d9d09e90dba8804eb7b42 Mon Sep 17 00:00:00 2001
From: Nicolas Allemand <[EMAIL REDACTED]>
Date: Wed, 4 Dec 2024 17:08:48 +0100
Subject: [PATCH] examples: fixup URLs for project subfolder

---
 build-scripts/build-web-examples.pl |  6 +++---
 examples/template-category.html     | 10 +++++++---
 examples/template-homepage.html     |  8 ++++++--
 examples/template.html              |  8 ++++----
 4 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/build-scripts/build-web-examples.pl b/build-scripts/build-web-examples.pl
index 6df912aa8c7c3..38b4186418a4c 100755
--- a/build-scripts/build-web-examples.pl
+++ b/build-scripts/build-web-examples.pl
@@ -180,7 +180,7 @@ sub handle_example_dir {
 
     my $other_examples_html = "<ul>";
     foreach my $example (get_examples_for_category($category)) {
-        $other_examples_html .= "<li><a href='/$category/$example'>$category/$example</a></li>";
+        $other_examples_html .= "<li><a href='/$project/$category/$example'>$category/$example</a></li>";
     }
     $other_examples_html .= "</ul>";
 
@@ -225,7 +225,7 @@ sub handle_category_dir {
         # !!! FIXME: image
         my $example_image_url = "https://placehold.co/600x400/png";
         $examples_list_html .= "
-        <a href='/$category/$example'>
+        <a href='/$project/$category/$example'>
           <div>
             <img src='$example_image_url' />
             <div>$category/$example</div>
@@ -297,7 +297,7 @@ sub handle_category_dir {
         # !!! FIXME: image
         my $example_image_url = "https://placehold.co/600x400/png";
         $homepage_list_html .= "
-            <a href='/$category/$example'>
+            <a href='/$project/$category/$example'>
             <div>
                 <img src='$example_image_url' />
                 <div>$category/$example</div>
diff --git a/examples/template-category.html b/examples/template-category.html
index bc79e8d834a8d..9872e9ad8e058 100644
--- a/examples/template-category.html
+++ b/examples/template-category.html
@@ -5,7 +5,11 @@
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     <meta name="viewport" content="width=device-width, initial-scale=1" />
     <title>@project_name@ Examples: @category_name@</title>
-    <link rel="stylesheet" type="text/css" href="/examples.css" />
+    <link
+      rel="stylesheet"
+      type="text/css"
+      href="/@project_name@/examples.css"
+    />
     <style>
       main > h1 {
         margin-top: 0;
@@ -19,8 +23,8 @@
     <main>
       <nav class="breadcrumb">
         <ul>
-          <li><a href="/">@project_name@</a></li>
-          <li><a href="/@category_name@">@category_name@</a></li>
+          <li><a href="/@project_name@/">@project_name@</a></li>
+          <li><a href="/@project_name@/@category_name@">@category_name@</a></li>
         </ul>
       </nav>
       <h1>@project_name@ examples: @category_name@</h1>
diff --git a/examples/template-homepage.html b/examples/template-homepage.html
index 369237df9e460..3dfbc9ef521e8 100644
--- a/examples/template-homepage.html
+++ b/examples/template-homepage.html
@@ -5,7 +5,11 @@
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     <meta name="viewport" content="width=device-width, initial-scale=1" />
     <title>@project_name@ Examples</title>
-    <link rel="stylesheet" type="text/css" href="/examples.css" />
+    <link
+      rel="stylesheet"
+      type="text/css"
+      href="/@project_name@/examples.css"
+    />
     <style>
       main > h1 {
         margin-top: 0;
@@ -19,7 +23,7 @@
     <main>
       <nav class="breadcrumb">
         <ul>
-          <li><a href="/">@project_name@</a></li>
+          <li><a href="/@project_name@">@project_name@</a></li>
         </ul>
       </nav>
       <h1>@project_name@ examples</h1>
diff --git a/examples/template.html b/examples/template.html
index caf6dccca456c..96f7cc13427eb 100644
--- a/examples/template.html
+++ b/examples/template.html
@@ -5,7 +5,7 @@
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
     <meta name="viewport" content="width=device-width, initial-scale=1" />
     <title>@project_name@ Example: @category_name@/@example_name@</title>
-    <link rel="stylesheet" type="text/css" href="/examples.css" />
+    <link rel="stylesheet" type="text/css" href="/@project_name@/examples.css" />
     <style>
       main {
         display: flex;
@@ -182,9 +182,9 @@
       <div id="content">
         <nav class="breadcrumb">
           <ul>
-            <li><a href="/">@project_name@</a></li>
-            <li><a href="/@category_name@">@category_name@</a></li>
-            <li><a href="/@category_name@/@example_name@">@example_name@</a></li>
+            <li><a href="/@project_name@">@project_name@</a></li>
+            <li><a href="/@project_name@/@category_name@">@category_name@</a></li>
+            <li><a href="/@project_name@/@category_name@/@example_name@">@example_name@</a></li>
           </ul>
         </nav>
         <h1>@project_name@ example: @category_name@/@example_name@</h1>