Skip to content

Publishing 0.1.4: Default language without a URL prefix

Publishing 0.1.4 can serve posts in the default language without a language prefix: /blog/post instead of /en/blog/post. Turn on Default Language Without Prefix under Public URL Language in the publishing settings.

The prefixed addresses then redirect permanently to the short ones. The setting is off by default, so existing addresses stay as they are.

Public addresses now use the short language code even when the site’s language is a regional one, so a site in British English links to /en/... rather than /en-GB/.... Older posts stored under the plain code, such as en, are moved to the regional language when it becomes the default, and each such repair is written to the activity log. The public language switcher no longer lists a language twice, and it marks the current one correctly.

Public publishing pages now pass the signed-in user to the site’s layout, so the header shows the user as logged in. The messages after turning the caches on or off are translated.

Full release notes: Publishing 0.1.4

0.1.4 · 24 April 2026

PR #9 — closes issues #6, #7, #8 plus related content-normalization and admin URL consistency work.

Added

  • publishing_default_language_no_prefix setting (Issue #7) — opt-in URL convention where the default language is served prefixless (/blog instead of /en/blog); prefixed URLs 301-redirect to the canonical. Language.request_matches_canonical_url?/2 prevents redirect loops.
  • LanguageHelpers.get_primary_language_base/0, url_language_code/1, use_language_prefix?/1 — normalize dialect codes ("en-GB") to URL base codes ("en") for public routing. (Issue #6)
  • StaleFixer.normalize_content_language/1 — self-healing for legacy base-only content rows ("en") when a dialect ("en-GB") becomes the default. Paired with TranslationManager legacy-base promotion and Posts.read_post lazy retry-on-miss.
  • Activity-log events for self-healing mutations: publishing.content.language_normalized, .merged, .promoted.
  • PhoenixKit.Modules.Publishing.ActivityLog wrapper — guarded with Code.ensure_loaded?/1 + try/rescue so audit failures never crash the primary mutation.
  • Controller test-endpoint infrastructure (Test.Endpoint, Test.Router, Test.Layouts, PhoenixKitPublishing.ConnCase).

Changed

  • Public URL builders (group_listing_path/3, build_post_url/4, build_public_path_with_time/4) normalize dialect codes via url_language_code/1.
  • Admin preview URLs (Web.Index, Web.Listing, Web.New) now route through PublishingHTML builders instead of hand-rolling prefix logic. (Follow-up to #6)
  • Public language switcher deduplicates base + dialect entries and highlights the active language exactly.

Fixed

  • Forward phoenix_kit_current_scope from Web.HTML.all_groups/1 and Web.HTML.index/1 into LayoutWrapper.app_layout so the parent app header sees authenticated users on public Publishing pages. (Issue #8)
  • Translation bug in cache-toggle flashes.
  • Dialyzer warning on a statically-true is_binary/1 guard introduced in PR #3.

Docs

  • AGENTS.md and README.md updated with the new setting, scope-forwarding convention for public templates, controller-test infrastructure pointer, and activity-log event table.

Publishing 0.1.4. Install or update: {:phoenix_kit_publishing, "~> 0.1"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.