add canonical URLs, robots.txt, and sitemap.xml

Canonical: all shop pages now assign og_url (reusing the existing og:url
assign), which the layout renders as <link rel="canonical">. Collection
pages strip the sort param so ?sort=price_asc doesn't create a duplicate
canonical.

robots.txt: dynamic controller disallows /admin/, /api/, /users/,
/webhooks/, /checkout/. Removed robots.txt from static_paths so it
goes through the router instead of Plug.Static.

sitemap.xml: auto-generated from all visible products + categories +
static pages, served as application/xml. 8 tests.

Also updates PROGRESS.md: marks tasks 55, 58, 59, 61, 62 as done.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
jamey
2026-02-23 21:47:35 +00:00
parent b11f7d47d0
commit 0f1135256d
16 changed files with 2144 additions and 13 deletions

View File

@@ -32,6 +32,7 @@ defmodule BerrypodWeb.Shop.Collection do
socket
|> assign(:page_title, title)
|> assign(:page_description, collection_description(title))
|> assign(:og_url, BerrypodWeb.Endpoint.url() <> "/collections/#{slug}")
|> assign(:collection_title, title)
|> assign(:current_category, category)
|> assign(:current_sort, sort)

View File

@@ -6,7 +6,11 @@ defmodule BerrypodWeb.Shop.Contact do
{:ok,
socket
|> assign(:page_title, "Contact")
|> assign(:page_description, "Get in touch with us for any questions or help with your order.")}
|> assign(
:page_description,
"Get in touch with us for any questions or help with your order."
)
|> assign(:og_url, BerrypodWeb.Endpoint.url() <> "/contact")}
end
@impl true

View File

@@ -25,6 +25,7 @@ defmodule BerrypodWeb.Shop.Content do
%{
page_title: "About",
page_description: "Your story goes here this is sample content for the demo shop",
og_url: BerrypodWeb.Endpoint.url() <> "/about",
active_page: "about",
hero_title: "About the studio",
hero_description: "Your story goes here this is sample content for the demo shop",
@@ -39,6 +40,7 @@ defmodule BerrypodWeb.Shop.Content do
%{
page_title: "Delivery & returns",
page_description: "Everything you need to know about shipping and returns.",
og_url: BerrypodWeb.Endpoint.url() <> "/delivery",
active_page: "delivery",
hero_title: "Delivery & returns",
hero_description: "Everything you need to know about shipping and returns",
@@ -50,6 +52,7 @@ defmodule BerrypodWeb.Shop.Content do
%{
page_title: "Privacy policy",
page_description: "How we handle your personal information.",
og_url: BerrypodWeb.Endpoint.url() <> "/privacy",
active_page: "privacy",
hero_title: "Privacy policy",
hero_description: "How we handle your personal information",
@@ -61,6 +64,7 @@ defmodule BerrypodWeb.Shop.Content do
%{
page_title: "Terms of service",
page_description: "The terms and conditions governing purchases from our shop.",
og_url: BerrypodWeb.Endpoint.url() <> "/terms",
active_page: "terms",
hero_title: "Terms of service",
hero_description: "The legal bits",

View File

@@ -10,6 +10,7 @@ defmodule BerrypodWeb.Shop.Home do
socket =
socket
|> assign(:page_title, "Home")
|> assign(:og_url, BerrypodWeb.Endpoint.url() <> "/")
|> assign(:products, products)
{:ok, socket}