mirror of
https://github.com/TheRealOwenRees/chess-endgame-trainer.git
synced 2026-11-18 11:42:07 +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:
@@ -0,0 +1,17 @@
|
||||
defmodule ChesstrainerWeb.Plugs.NoIndex do
|
||||
@moduledoc """
|
||||
Tells crawlers not to index the response.
|
||||
|
||||
Uses the `X-Robots-Tag` header rather than a `<meta name="robots">` tag: it
|
||||
survives redirects and authentication failures, and covers LiveView pages
|
||||
without every template having to assign `:noindex`.
|
||||
"""
|
||||
|
||||
import Plug.Conn
|
||||
|
||||
def init(opts), do: opts
|
||||
|
||||
def call(conn, _opts) do
|
||||
put_resp_header(conn, "x-robots-tag", "noindex, nofollow")
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user