add published custom pages to sitemap
All checks were successful
deploy / deploy (push) Successful in 1m20s

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
jamey
2026-02-28 11:37:16 +00:00
parent 3a243151af
commit 22d7b0e92b
3 changed files with 26 additions and 3 deletions

View File

@@ -4,7 +4,11 @@ defmodule BerrypodWeb.SeoControllerTest do
import Berrypod.AccountsFixtures
import Berrypod.ProductsFixtures
alias Berrypod.Pages
alias Berrypod.Pages.PageCache
setup do
PageCache.invalidate_all()
user_fixture()
{:ok, _} = Berrypod.Settings.set_site_live(true)
:ok
@@ -64,5 +68,19 @@ defmodule BerrypodWeb.SeoControllerTest do
assert body =~ "<urlset"
assert body =~ "</urlset>"
end
test "includes published custom pages", %{conn: conn} do
{:ok, _} = Pages.create_custom_page(%{slug: "faq", title: "FAQ", published: true})
body = get(conn, "/sitemap.xml") |> response(200)
assert body =~ "/faq"
end
test "excludes unpublished custom pages", %{conn: conn} do
{:ok, _} = Pages.create_custom_page(%{slug: "draft", title: "Draft", published: false})
body = get(conn, "/sitemap.xml") |> response(200)
refute body =~ "/draft"
end
end
end