Entities 0.2.3: Faster sitemap generation for multi-language sites
Entities 0.2.3 makes building the entities part of the sitemap cheaper, especially on sites with many records and languages. The URLs themselves do not change.
Each record’s address used to re-read the site-wide language settings to decide on its language prefix, several lookups per URL for the same answer. The prefix is now worked out once per language for the whole run. The decision itself now comes from PhoenixKit’s shared helpers, the same ones core’s own sitemap sources use. For developers, UrlResolver.locale_prefix/2 gives that prefix.
The documented examples of public record URLs were also corrected: by default, the primary language does get a prefix, such as /en/products/my-item, unless the site turns prefixless primary URLs on. The empty Entities list and file sizes in forms now use PhoenixKit’s shared components and formatting.
Full release notes: Entities 0.2.3
0.2.3 · 21 May 2026
Added
PhoenixKitEntities.UrlResolver.locale_prefix/2— resolves the constant locale path-prefix ("/en","", …) for a(language, is_default)pair. Built for batch callers like sitemap generation: resolve once and prepend to many paths instead of re-reading the site-wide locale settings per URL.
Changed
UrlResolvernow delegates to the framework-sharedphoenix_kitcore helpers instead of maintaining parallel copies:build_path_with_language/3‘s prefix decision goes throughPhoenixKit.Modules.Sitemap.LocalePath.emit_prefix?/2(the same policy core’s own sitemap sources use), and the boot-safe primary-language check usesPhoenixKit.Modules.Languages.prefixless_primary_safe?/0(which also handles the mix-task context the previous local rescue missed). Behaviour-preserving.SitemapSourceresolves the locale prefix once per generation indo_collect/1andsub_sitemaps/1and threads it through the entry builders, replacing the per-URL(language, is_default)arguments. The previous code calledbuild_path_with_language/3per generated URL, each re-reading the site-wide locale settings viaPhoenixKit.Cache(several serializedGenServer.calls) — roughly4·N·Llookups returning the same constant. The hot path is now a plain string prepend; per-generation settings lookups drop from O(N·L) to O(1).
Fixed
EntityData.public_path/3andpublic_alternates/3docstrings documented the pre-default_language_no_prefixbehaviour (“primary language → no prefix”) and shipped example URLs that were wrong under the default (setting OFF) — the primary language now gets the prefix (/en/products/my-item) unless the site-wide setting is ON. Prose and examples corrected. (These were illustrative, non-executed examples, so the suite was unaffected.)
Entities 0.2.3. Install or update: {:phoenix_kit_entities, "~> 0.2"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.