# `PhoenixKit.ResourceLinks`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.213/lib/phoenix_kit/resource_links.ex#L1)

Resolves `(resource_type, resource_uuid)` pairs into navigable deep-links to
the underlying resource — the record an action happened on or a comment is
attached to.

Two-tier resolution, tried in order per `resource_type`:

1. **Handler modules** — a module registered for the type that exports
   `resolve_comment_resources/1`, returning `%{uuid => %{title, path, thumb_url?}}`
   with a **raw** phoenix_kit path (`Routes.path/1` is applied once at render
   time — pre-applying it would double-prefix under a non-root `url_prefix`).
   Auto-registered when the module is loaded: `"post" => PhoenixKitPosts`,
   `"file" => PhoenixKit.Annotations`, `"user" => PhoenixKit.Users.CommentResources`.
   Hosts add more via `config :phoenix_kit, :comment_resource_handlers`.

2. **String path templates** — the `comment_resource_paths` setting, a no-code
   JSON map (`%{"shoes" => "/order/shoes/:uuid"}`) with `:uuid` / `:prefix` /
   `:metadata.<key>` placeholders.

Shared by the Comments moderation admin (`PhoenixKitComments` delegates here)
and the Activity feed. The handler contract and setting name keep the
historical `comment_*` naming, but the mechanism is resource-generic — a
resource that deep-links in comments deep-links in Activity with no extra
config.

## Items

`resolve/1` accepts any list of maps/structs exposing `:resource_type`,
`:resource_uuid`, and (optionally) `:metadata` — both `PhoenixKit.Activity.Entry`
and comment structs qualify. Items missing a type or uuid are skipped.

Returns a map keyed by `{resource_type, resource_uuid}`, each value a map:

    %{title: String.t(), full_title: String.t(), path: String.t(),
      prefixed: boolean(), thumb_url: String.t() (optional)}

`prefixed: true` means `path` is a raw phoenix_kit route — pass it through
`url/1` (→ `Routes.path/1`) and SPA-navigate. `prefixed: false` comes from a
host template and should render as a plain `href`.

# `get_resource_path_templates`

Gets configured resource path templates (path + optional display title).

Returns a map of `resource_type => config`, where config is either a plain
string (legacy path-only format) or a map with `"path"` and optional `"title"`
keys.

    %{"shoes" => "/order/shoes/:uuid"}
    %{"shoes" => %{"path" => "/order/shoes/:uuid", "title" => ":metadata.name"}}

# `handlers`

The registered `resource_type => handler_module` map.

Merges, in increasing precedence: the auto-registered core defaults (loaded
post/file/user/integration modules), the module-declared handlers (the
`resource_links/0` `PhoenixKit.Module` callback entries whose value is a
resolver module), and the host's `config :phoenix_kit, :comment_resource_handlers`
overrides. Exposed so other consumers (e.g. the comments notification-callback
dispatch) resolve a resource type against the same registry the deep-links use.

# `info_for`

Looks up a resolved info map for a single `(resource_type, resource_uuid)` pair.

Returns `nil` when the pair was not resolvable.

# `resolve`

Resolves resource context (title + path) for a list of items.

See the module doc for the item and return shapes.

# `update_resource_path_templates`

Updates resource path templates for resource types.

Accepts both legacy string values and new map values with `"path"` and
`"title"` keys.

# `url`

Final navigable path for a resolved info map.

Applies `Routes.path/1` (URL prefix + locale) to raw phoenix_kit paths
(`prefixed: true`); returns host-template paths (`prefixed: false`) verbatim.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
