2026-02-18 21:23:15 +00:00
|
|
|
defmodule BerrypodWeb.Shop.Home do
|
|
|
|
|
use BerrypodWeb, :live_view
|
2026-01-17 16:19:35 +00:00
|
|
|
|
2026-02-26 18:29:20 +00:00
|
|
|
alias Berrypod.Pages
|
2026-01-17 16:19:35 +00:00
|
|
|
|
|
|
|
|
@impl true
|
|
|
|
|
def mount(_params, _session, socket) do
|
2026-02-26 18:29:20 +00:00
|
|
|
page = Pages.get_page("home")
|
|
|
|
|
extra = Pages.load_block_data(page.blocks, socket.assigns)
|
2026-01-17 16:19:35 +00:00
|
|
|
|
2026-02-23 22:37:34 +00:00
|
|
|
base = BerrypodWeb.Endpoint.url()
|
|
|
|
|
site_name = socket.assigns.theme_settings.site_name
|
|
|
|
|
|
|
|
|
|
org_ld =
|
|
|
|
|
Jason.encode!(
|
|
|
|
|
%{
|
|
|
|
|
"@context" => "https://schema.org",
|
|
|
|
|
"@type" => "Organization",
|
|
|
|
|
"name" => site_name,
|
|
|
|
|
"url" => base <> "/"
|
|
|
|
|
},
|
|
|
|
|
escape: :html_safe
|
|
|
|
|
)
|
|
|
|
|
|
2026-01-17 16:19:35 +00:00
|
|
|
socket =
|
|
|
|
|
socket
|
|
|
|
|
|> assign(:page_title, "Home")
|
2026-02-23 22:37:34 +00:00
|
|
|
|> assign(:og_url, base <> "/")
|
|
|
|
|
|> assign(:json_ld, org_ld)
|
2026-02-26 18:29:20 +00:00
|
|
|
|> assign(:page, page)
|
|
|
|
|
|> assign(extra)
|
2026-01-17 16:19:35 +00:00
|
|
|
|
|
|
|
|
{:ok, socket}
|
|
|
|
|
end
|
2026-01-17 22:17:59 +00:00
|
|
|
|
|
|
|
|
@impl true
|
|
|
|
|
def render(assigns) do
|
|
|
|
|
~H"""
|
2026-02-26 18:29:20 +00:00
|
|
|
<BerrypodWeb.PageRenderer.render_page {assigns} />
|
2026-01-17 22:17:59 +00:00
|
|
|
"""
|
|
|
|
|
end
|
2026-01-17 16:19:35 +00:00
|
|
|
end
|