Skip to content

Add phoenix_kit_favicon component for parent-owned head - #504

Merged
ddon merged 1 commit into
BeamLabEU:devfrom
timujinne:feature/phoenix-kit-favicon
Apr 23, 2026
Merged

Add phoenix_kit_favicon component for parent-owned head#504
ddon merged 1 commit into
BeamLabEU:devfrom
timujinne:feature/phoenix-kit-favicon

Conversation

@timujinne

Copy link
Copy Markdown
Contributor

Summary

Until now the site_icon_file_uuid setting (introduced in 1.7.97) only reached the browser tab in PhoenixKit standalone mode — render_admin_only_layout injected <link rel="icon"> inline, but render_admin_with_parent and fully public parent-owned layouts had no way to pick up the uploaded favicon. So in production setups where the parent application owns <head>, the icon was saved correctly but never rendered.

Changes

  • Extract favicon markup into a new reusable component: PhoenixKitWeb.Components.Core.PhoenixKitFavicon. It reads site_icon_file_uuid from Settings via get_setting_cached/2, signs a storage URL through Modules.Storage.URLSigner, and renders nothing when the setting is empty so existing static favicons keep working.
  • Parent applications can now include <PhoenixKitWeb.Components.Core.PhoenixKitFavicon.phoenix_kit_favicon /> in their root.html.heex<head> to get the uploaded icon.
  • Replace the inline favicon code in render_admin_only_layout with the new component (no behaviour change in standalone).
  • Invoke the component next to <.phoenix_kit_globals /> in render_admin_with_parent, so PhoenixKit admin pages rendered inside a parent layout still pick up the uploaded icon even before the parent app adopts the helper in its own <head>.

Test plan

  • mix compile --warnings-as-errors — clean
  • mix credo --strict on changed files — clean
  • Manual: verified favicon renders on a parent-app admin page after uploading a site icon in Settings

Until now the site_icon_file_uuid setting only reached the browser tab
in PhoenixKit standalone mode — render_admin_only_layout injected the
<link rel="icon"> inline, but render_admin_with_parent and fully public
parent-owned layouts had no way to pick up the uploaded favicon.
Extract that logic into PhoenixKitWeb.Components.Core.PhoenixKitFavicon
so parent applications can drop <.phoenix_kit_favicon /> into their
root.html.heex <head>. The component reads the cached setting, signs
the storage URL, and renders nothing when the setting is empty so
existing static favicons keep working.
Also invoke the component next to <.phoenix_kit_globals /> in the
render_admin_with_parent path so admin pages rendered inside a parent
layout still get the uploaded icon even if the parent app hasn't added
the helper yet.
@ddon
ddon merged commit c87cd4e into BeamLabEU:devApr 23, 2026
timujinne added a commit to timujinne/phoenix_kit that referenced this pull request Apr 28, 2026
Brings in:
- phoenix_kit_favicon component (PR BeamLabEU#504)
- Per-user notifications module (V104)
- dynamic_children/2 with locale (PR BeamLabEU#506)
- arity-2 dynamic_children callbacks (PR BeamLabEU#505)
- Bump to 1.7.101
- Claude review docs for PRs BeamLabEU#505/506
@timujinne
timujinne deleted the feature/phoenix-kit-favicon branch June 25, 2026 08:42
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@timujinne@ddon