mirror of
https://github.com/TheRealOwenRees/chess-endgame-trainer.git
synced 2026-11-18 03:32:06 +00:00
add sitemap, robots, and noindex admin routes (#85)
Serve a runtime sitemap.xml with the indexable marketing pages only; endgame play pages are left out to avoid indexing tens of thousands of near-identical pages. Generate robots.txt at runtime so it points at the sitemap on the deployment's host, and send X-Robots-Tag: noindex from every /admin response.
This commit is contained in:
@@ -59,6 +59,27 @@ defmodule ChesstrainerWeb.AdminGatingTest do
|
||||
assert html_response(conn, 200)
|
||||
end
|
||||
|
||||
test "admin routes are marked noindex for crawlers", %{conn: conn} do
|
||||
conn = get(conn, ~p"/admin/endgames")
|
||||
|
||||
assert get_resp_header(conn, "x-robots-tag") == ["noindex, nofollow"]
|
||||
|
||||
{:ok, admin} = Accounts.update_user_role(user_fixture(), :admin)
|
||||
|
||||
conn =
|
||||
build_conn()
|
||||
|> log_in_user(admin)
|
||||
|> get(~p"/admin/endgames")
|
||||
|
||||
assert get_resp_header(conn, "x-robots-tag") == ["noindex, nofollow"]
|
||||
end
|
||||
|
||||
test "public pages are not marked noindex", %{conn: conn} do
|
||||
conn = get(conn, ~p"/")
|
||||
|
||||
assert get_resp_header(conn, "x-robots-tag") == []
|
||||
end
|
||||
|
||||
test "the navbar hides the Admin link from members", %{conn: conn} do
|
||||
conn =
|
||||
conn
|
||||
|
||||
Reference in New Issue
Block a user