@@ -4395,7 +4395,6 @@ defmodule Beacon.Content do
43954395 case insert_published_page ( page ) do
43964396 { :ok , page } ->
43974397 :ok = Beacon.PubSub . page_published ( page )
4398- # Async: extract internal links from the published page
43994398 maybe_rebuild_links_async ( page )
44004399 { :reply , { :ok , page } , config }
44014400
@@ -4404,26 +4403,6 @@ defmodule Beacon.Content do
44044403 end
44054404 end
44064405
4407- defp maybe_rebuild_links_async ( page ) do
4408- Task . start ( fn ->
4409- try do
4410- template = Beacon.Lifecycle.Template . load_template ( page )
4411- ast = Beacon.Template.Parser . parse ( template )
4412- component_registry = build_component_registry_for_ast ( page . site )
4413- expanded = Beacon.Template.ComponentExpander . expand ( ast , component_registry )
4414- # Render with empty assigns — works for static pages.
4415- # Pages with data bindings will fail here, which is expected.
4416- # Their links are extracted when the client reports them (future feature).
4417- html = Beacon.Client.LiveViewCompiler . render_to_string ( expanded , % { } )
4418- rebuild_links_for_page ( page . site , page . id , html )
4419- rescue
4420- _error -> :ok
4421- catch
4422- _kind , _reason -> :ok
4423- end
4424- end )
4425- end
4426-
44274406 @ doc false
44284407 def handle_call ( { :unpublish_page , page } , _from , config ) do
44294408 case insert_unpublished_page ( page ) do
@@ -4879,6 +4858,23 @@ defmodule Beacon.Content do
48794858 { :noreply , config }
48804859 end
48814860
4861+ defp maybe_rebuild_links_async ( page ) do
4862+ Task . start ( fn ->
4863+ try do
4864+ template = Beacon.Lifecycle.Template . load_template ( page )
4865+ ast = Beacon.Template.Parser . parse ( template )
4866+ component_registry = build_component_registry_for_ast ( page . site )
4867+ expanded = Beacon.Template.ComponentExpander . expand ( ast , component_registry )
4868+ html = Beacon.Client.LiveViewCompiler . render_to_string ( expanded , % { } )
4869+ rebuild_links_for_page ( page . site , page . id , html )
4870+ rescue
4871+ _error -> :ok
4872+ catch
4873+ _kind , _reason -> :ok
4874+ end
4875+ end )
4876+ end
4877+
48824878 # ---------------------------------------------------------------------------
48834879 # Template Types
48844880 # ---------------------------------------------------------------------------
@@ -4909,7 +4905,7 @@ defmodule Beacon.Content do
49094905 @ doc "Lists template types available to a site (includes global types where site is nil)."
49104906 @ doc type: :template_types
49114907 @ spec list_template_types ( Site . t ( ) , keyword ( ) ) :: [ TemplateType . t ( ) ]
4912- def list_template_types ( site , opts \\ [ ] ) when is_atom ( site ) do
4908+ def list_template_types ( site , _opts \\ [ ] ) when is_atom ( site ) do
49134909 from ( tt in TemplateType ,
49144910 where: tt . site == ^ site or is_nil ( tt . site ) ,
49154911 order_by: [ asc: tt . name ]
0 commit comments