Files
berrypod/lib/berrypod_web/live/shop/pages/search.ex
jamey 4aa7dece0c
All checks were successful
deploy / deploy (push) Successful in 4m59s
add SEO enhancements: OG images, meta robots, FAQ block, image sitemap
- Per-page SEO controls: meta robots directives, focus keyword, OG image
- Site-wide default OG image in admin settings
- FAQ block type with FAQPage JSON-LD schema
- Enhanced Organization JSON-LD with business info, contact, address
- Image sitemap with product images
- SEO preview panel with Google/social card mockups
- SEO checklist with real-time scoring
- Business info section in site editor
- GSC integration scaffolding (OAuth, client, cache)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-17 16:47:43 +01:00

52 lines
1.2 KiB
Elixir

defmodule BerrypodWeb.Shop.Pages.Search do
@moduledoc """
Search page handler for the unified Shop.Page LiveView.
"""
import Phoenix.Component, only: [assign: 3]
import Phoenix.LiveView, only: [push_patch: 2]
alias Berrypod.{Pages, Search}
alias BerrypodWeb.R
def init(socket, _params, _uri) do
page = Pages.get_page("search")
socket =
socket
|> assign(:page_title, "Search")
|> assign(:page, page)
|> maybe_assign_meta_robots(page)
{:noreply, socket}
end
defp maybe_assign_meta_robots(socket, page) do
meta_robots = page && page[:meta_robots]
if meta_robots && meta_robots != "index, follow" do
assign(socket, :meta_robots, meta_robots)
else
socket
end
end
def handle_params(params, _uri, socket) do
query = params["q"] || ""
results = if query != "", do: Search.search(query), else: []
socket =
socket
|> assign(:search_page_query, query)
|> assign(:search_page_results, results)
{:noreply, socket}
end
def handle_event("search_submit", %{"q" => query}, socket) do
{:noreply, push_patch(socket, to: R.search() <> "?q=#{query}")}
end
def handle_event(_event, _params, _socket), do: :cont
end