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:
@@ -26,6 +26,11 @@ defmodule BerrypodWeb.Router do
|
||||
plug :put_secure_browser_headers
|
||||
end
|
||||
|
||||
# Minimal pipeline for robots.txt and sitemap.xml
|
||||
pipeline :seo do
|
||||
plug :put_secure_browser_headers
|
||||
end
|
||||
|
||||
pipeline :printify_webhook do
|
||||
plug BerrypodWeb.Plugs.VerifyPrintifyWebhook
|
||||
end
|
||||
@@ -90,6 +95,14 @@ defmodule BerrypodWeb.Router do
|
||||
get "/health", HealthController, :show
|
||||
end
|
||||
|
||||
# SEO — crawlers need these without any session/auth overhead
|
||||
scope "/", BerrypodWeb do
|
||||
pipe_through [:seo]
|
||||
|
||||
get "/robots.txt", SeoController, :robots
|
||||
get "/sitemap.xml", SeoController, :sitemap
|
||||
end
|
||||
|
||||
# Cart API (session persistence for LiveView)
|
||||
scope "/api", BerrypodWeb do
|
||||
pipe_through [:browser]
|
||||
|
||||
Reference in New Issue
Block a user