From e85bd30dd64ea3736c1b7e51bde26f50d68f6816 Mon Sep 17 00:00:00 2001
From: naindev <193035803+Nain9Dev@users.noreply.github.com>
Date: Mon, 9 Nov 2026 22:59:16 +0100
Subject: [PATCH] feat(seo): add canonical, social metadata, JSON-LD and
crawler files
Declare canonical URL, Open Graph, Twitter card and SoftwareApplication
JSON-LD in the public page and serve robots.txt, sitemap.xml and llms.txt
from the site root. Covered by SeoDiscoverabilityTests (REQ-064).
---
NainOrder.Api/wwwroot/index.html | 34 +++++
NainOrder.Api/wwwroot/llms.txt | 9 ++
NainOrder.Api/wwwroot/robots.txt | 4 +
NainOrder.Api/wwwroot/sitemap.xml | 6 +
.../Api/SeoDiscoverabilityTests.cs | 139 ++++++++++++++++++
docs/10-requirements.md | 1 +
docs/50-traceability.md | 1 +
docs/90-changelog.md | 3 +
specs/next-seo-discoverability/plan.md | 9 ++
specs/next-seo-discoverability/spec.md | 26 ++++
specs/next-seo-discoverability/tasks.md | 12 ++
11 files changed, 244 insertions(+)
create mode 100644 NainOrder.Api/wwwroot/llms.txt
create mode 100644 NainOrder.Api/wwwroot/robots.txt
create mode 100644 NainOrder.Api/wwwroot/sitemap.xml
create mode 100644 NainOrder.Tests/Api/SeoDiscoverabilityTests.cs
create mode 100644 specs/next-seo-discoverability/plan.md
create mode 100644 specs/next-seo-discoverability/spec.md
create mode 100644 specs/next-seo-discoverability/tasks.md
diff --git a/NainOrder.Api/wwwroot/index.html b/NainOrder.Api/wwwroot/index.html
index a08306a..e7eeaad 100644
--- a/NainOrder.Api/wwwroot/index.html
+++ b/NainOrder.Api/wwwroot/index.html
@@ -5,6 +5,40 @@
NainOrder · Drop engine
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/NainOrder.Api/wwwroot/llms.txt b/NainOrder.Api/wwwroot/llms.txt
new file mode 100644
index 0000000..d8f8031
--- /dev/null
+++ b/NainOrder.Api/wwwroot/llms.txt
@@ -0,0 +1,9 @@
+# NainOrder
+
+> Order engine for limited drops: exact units, expiring holds and nothing sold twice, built as a .NET API with Clean Architecture and an installable web panel.
+
+## Links
+
+- [Live demo](https://order.naindev.com/): the interactive panel
+- [Source code](https://github.com/Nain9Dev/NainOrder): repository, architecture notes and documentation
+- [Author site](https://www.naindev.com/): Aitor Nain Mendoza Vallejo (NainDev)
diff --git a/NainOrder.Api/wwwroot/robots.txt b/NainOrder.Api/wwwroot/robots.txt
new file mode 100644
index 0000000..9b564c5
--- /dev/null
+++ b/NainOrder.Api/wwwroot/robots.txt
@@ -0,0 +1,4 @@
+User-agent: *
+Allow: /
+
+Sitemap: https://order.naindev.com/sitemap.xml
diff --git a/NainOrder.Api/wwwroot/sitemap.xml b/NainOrder.Api/wwwroot/sitemap.xml
new file mode 100644
index 0000000..aeb56b5
--- /dev/null
+++ b/NainOrder.Api/wwwroot/sitemap.xml
@@ -0,0 +1,6 @@
+
+
+
+ https://order.naindev.com/
+
+
diff --git a/NainOrder.Tests/Api/SeoDiscoverabilityTests.cs b/NainOrder.Tests/Api/SeoDiscoverabilityTests.cs
new file mode 100644
index 0000000..6005f32
--- /dev/null
+++ b/NainOrder.Tests/Api/SeoDiscoverabilityTests.cs
@@ -0,0 +1,139 @@
+using System.Text.Json;
+using System.Text.RegularExpressions;
+using System.Xml.Linq;
+
+namespace NainOrder.Tests.Api;
+
+///
+/// REQ-064: the public page declares what search engines and AI crawlers need (one canonical URL,
+/// a description of sensible length, Open Graph, Twitter card and JSON-LD) and the three
+/// discovery files are served from the site root, not swallowed by the SPA fallback.
+///
+public class SeoDiscoverabilityTests : IClassFixture
+{
+ private const string Canonical = "https://order.naindev.com/";
+ private const string AuthorId = "https://www.naindev.com/#person";
+ private const string Repository = "https://github.com/Nain9Dev/NainOrder";
+
+ private static readonly string Root = Path.GetFullPath(Path.Combine(
+ AppContext.BaseDirectory, "../../../../NainOrder.Api/wwwroot"));
+
+ private static readonly TimeSpan RegexTimeout = TimeSpan.FromSeconds(1);
+
+ private readonly HttpClient _client;
+
+ public SeoDiscoverabilityTests(NainOrderApiFactory factory) => _client = factory.CreateClient();
+
+ private static string Html() => File.ReadAllText(Path.Combine(Root, "index.html"));
+
+ private static List MetaContents(string html, string attribute, string key) =>
+ Regex.Matches(html, "]*>", RegexOptions.IgnoreCase, RegexTimeout)
+ .Select(m => m.Value)
+ .Where(tag => Regex.IsMatch(tag, $"{attribute}=\"{Regex.Escape(key)}\"", RegexOptions.IgnoreCase, RegexTimeout))
+ .Select(tag => Regex.Match(tag, "content=\"([^\"]*)\"", RegexOptions.IgnoreCase, RegexTimeout).Groups[1].Value)
+ .ToList();
+
+ private static string Meta(string html, string attribute, string key)
+ {
+ var values = MetaContents(html, attribute, key);
+ Assert.True(values.Count == 1, $"Expected exactly one , found {values.Count}.");
+ return values[0];
+ }
+
+ [Fact]
+ public void The_page_declares_exactly_one_canonical_link_equal_to_the_host_root()
+ {
+ var links = Regex.Matches(Html(), "]*rel=\"canonical\"[^>]*>", RegexOptions.IgnoreCase, RegexTimeout);
+
+ Assert.Single(links);
+ Assert.Contains($"href=\"{Canonical}\"", links[0].Value, StringComparison.Ordinal);
+ }
+
+ [Fact]
+ public void The_description_is_a_single_tag_of_70_to_160_characters()
+ {
+ var description = Meta(Html(), "name", "description");
+
+ Assert.InRange(description.Length, 70, 160);
+ }
+
+ [Fact]
+ public void Open_Graph_and_Twitter_cards_describe_the_page_and_agree_with_the_canonical_url()
+ {
+ var html = Html();
+
+ Assert.Equal("website", Meta(html, "property", "og:type"));
+ Assert.Equal("NainOrder", Meta(html, "property", "og:site_name"));
+ Assert.False(string.IsNullOrWhiteSpace(Meta(html, "property", "og:title")));
+ Assert.False(string.IsNullOrWhiteSpace(Meta(html, "property", "og:description")));
+ Assert.Equal(Canonical, Meta(html, "property", "og:url"));
+ Assert.StartsWith("https://", Meta(html, "property", "og:image"), StringComparison.Ordinal);
+ Assert.Equal("1200", Meta(html, "property", "og:image:width"));
+ Assert.Equal("630", Meta(html, "property", "og:image:height"));
+
+ Assert.Equal("summary_large_image", Meta(html, "name", "twitter:card"));
+ Assert.False(string.IsNullOrWhiteSpace(Meta(html, "name", "twitter:title")));
+ Assert.False(string.IsNullOrWhiteSpace(Meta(html, "name", "twitter:description")));
+ Assert.Equal(Meta(html, "property", "og:image"), Meta(html, "name", "twitter:image"));
+ }
+
+ [Fact]
+ public void The_page_links_its_author()
+ {
+ Assert.Matches("(.*?)",
+ RegexOptions.Singleline, RegexTimeout);
+ Assert.Single(blocks);
+
+ var data = JsonDocument.Parse(blocks[0].Groups[1].Value).RootElement;
+
+ Assert.Equal("SoftwareApplication", data.GetProperty("@type").GetString());
+ Assert.Equal("NainOrder", data.GetProperty("name").GetString());
+ Assert.Equal(Canonical, data.GetProperty("url").GetString());
+ Assert.Equal("Web", data.GetProperty("operatingSystem").GetString());
+ Assert.True(data.GetProperty("isAccessibleForFree").GetBoolean());
+ Assert.Equal(Meta(Html(), "name", "description"), data.GetProperty("description").GetString());
+ Assert.Equal(AuthorId, data.GetProperty("author").GetProperty("@id").GetString());
+ Assert.Contains(Repository, data.GetProperty("sameAs").EnumerateArray().Select(e => e.GetString()));
+ }
+
+ [Fact]
+ public void The_discovery_files_are_served_from_the_root_and_not_by_the_spa_fallback()
+ {
+ foreach (var file in new[] { "robots.txt", "sitemap.xml", "llms.txt" })
+ Assert.True(File.Exists(Path.Combine(Root, file)), $"{file} is missing from wwwroot.");
+
+ var robots = File.ReadAllText(Path.Combine(Root, "robots.txt"));
+ Assert.Contains("User-agent: *", robots, StringComparison.Ordinal);
+ Assert.Contains("Allow: /", robots, StringComparison.Ordinal);
+ Assert.DoesNotContain("Disallow: /", robots, StringComparison.Ordinal);
+ Assert.Contains($"Sitemap: {Canonical}sitemap.xml", robots, StringComparison.Ordinal);
+
+ var sitemap = XDocument.Parse(File.ReadAllText(Path.Combine(Root, "sitemap.xml")));
+ var loc = sitemap.Descendants().Single(e => e.Name.LocalName == "loc").Value;
+ Assert.Equal(Canonical, loc);
+
+ var llms = File.ReadAllText(Path.Combine(Root, "llms.txt"));
+ Assert.StartsWith("# NainOrder", llms, StringComparison.Ordinal);
+ Assert.Contains(Repository, llms, StringComparison.Ordinal);
+ Assert.Contains("https://www.naindev.com/", llms, StringComparison.Ordinal);
+ }
+
+ [Theory]
+ [InlineData("/robots.txt", "text/plain")]
+ [InlineData("/sitemap.xml", "xml")]
+ [InlineData("/llms.txt", "text/plain")]
+ public async Task The_application_serves_each_discovery_file_with_its_own_content_type(string path, string mediaType)
+ {
+ var response = await _client.GetAsync(path);
+
+ response.EnsureSuccessStatusCode();
+ Assert.Contains(mediaType, response.Content.Headers.ContentType!.MediaType, StringComparison.Ordinal);
+ Assert.DoesNotContain("` of `wwwroot/index.html`.
+3. Add `robots.txt`, `sitemap.xml` and `llms.txt` to `wwwroot`.
+
+No change in Domain, Application, Infrastructure or the controllers.
diff --git a/specs/next-seo-discoverability/spec.md b/specs/next-seo-discoverability/spec.md
new file mode 100644
index 0000000..dfa5125
--- /dev/null
+++ b/specs/next-seo-discoverability/spec.md
@@ -0,0 +1,26 @@
+# next-seo-discoverability — Search and AI-engine discoverability
+
+**Status:** Draft — requested by the owner (2026-11-09) as a baseline for all public demo sites.
+
+## Goal
+
+A crawler or an AI engine that fetches `https://order.naindev.com/` learns what the product is,
+who made it and where the source lives, without executing the panel's JavaScript.
+
+## Requirements (EARS)
+
+- **REQ-064** — The public page shall declare one canonical URL, a 70 to 160 character description, Open Graph and Twitter card metadata and `SoftwareApplication` JSON-LD naming its author, and the application shall serve `/robots.txt`, `/sitemap.xml` and `/llms.txt` as real files from the site root.
+
+## Notes
+
+- The static HTML has no `` outside `