Skip to content

<.live_title> contains line breaks in new projects #6666

@lubien

Description

@lubien

Environment

  • Elixir version (elixir -v): Elixir 1.19.3 (compiled with Erlang/OTP 26)
  • Phoenix version (mix deps): phoenix 1.8.5 (Hex package) (mix)
  • Operating system: Mac M4

Actual behavior

Title is rendered in HTML with a line break that is reflected in previews on messenger apps like discord, whatsapp, telegram

Image Image
<!-- <LineupWeb.Layouts.root> lib/lineup_web/components/layouts/root.html.heex:1 (lineup) --><!DOCTYPE html>
--
<meta data-phx-loc="6" name="csrf-token" content="PT8QITcfJGYMPCsEBRVbFhYUEwcKPzg-voxPZSe9jfDNga9GnUv2cPKO">
<!-- @caller lib/lineup_web/components/layouts/root.html.heex:7 (lineup) --><!-- <Phoenix.Component.live_title> lib/phoenix_component.ex:2248 (phoenix_live_view) --><title data-phx-loc="2249" data-default="Lineup" data-suffix=" · Phoenix Framework">
Listing Tickets
· Phoenix Framework</title>
...
  def mount(_params, _session, socket) do
    {:ok,
     socket
     |> assign(:page_title, "Listing Tickets")}
  end
...
Image

Adding phx-no-format solves this, Ive been doing that lately, maybe we can add that to the default template?

<.live_title default="Lineup" suffix=" · Phoenix Framework" phx-no-format>{assigns[:page_title]}</.live_title>

Expected behavior

Live title stays in a single line:

<title data-phx-loc="2249" data-default="Lineup" data-suffix=" · Phoenix Framework">Listing Tickets · Phoenix Framework</title>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions