add SEO enhancements: OG images, meta robots, FAQ block, image sitemap
All checks were successful
deploy / deploy (push) Successful in 4m59s
All checks were successful
deploy / deploy (push) Successful in 4m59s
- 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>
This commit is contained in:
@@ -7,6 +7,7 @@ defmodule BerrypodWeb.Shop.Pages.Collection do
|
||||
import Phoenix.LiveView, only: [push_patch: 2, push_navigate: 2, put_flash: 3]
|
||||
|
||||
alias Berrypod.{Pages, Pagination, Products}
|
||||
alias BerrypodWeb.Helpers.SeoHelpers
|
||||
alias BerrypodWeb.R
|
||||
|
||||
@sort_options [
|
||||
@@ -20,16 +21,29 @@ defmodule BerrypodWeb.Shop.Pages.Collection do
|
||||
|
||||
def init(socket, _params, _uri) do
|
||||
page = Pages.get_page("collection")
|
||||
base = BerrypodWeb.Endpoint.url()
|
||||
|
||||
socket =
|
||||
socket
|
||||
|> assign(:page, page)
|
||||
|> assign(:sort_options, @sort_options)
|
||||
|> assign(:current_sort, "featured")
|
||||
|> maybe_assign_meta_robots(page)
|
||||
|> SeoHelpers.assign_og_image(page, base)
|
||||
|
||||
{: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
|
||||
|
||||
# When accessed via custom URL (e.g. /shop) without a collection slug, show all products
|
||||
def handle_params(params, uri, socket) when not is_map_key(params, "slug") do
|
||||
handle_params(Map.put(params, "slug", "all"), uri, socket)
|
||||
|
||||
Reference in New Issue
Block a user