How do you update a page's title, meta description, open graph and other head tags when using Turbo Frames with "advance"?

Hi,

Interesting. I replied in the PR you linked a few weeks ago but the author of the PR didn’t mention what they’ve added would allow for this use case.

In a pre-frames world I would have added this into let’s say a new.html.erb page:

<%
  content_for(:title) { t('.title') }
  content_for(:meta_description) { t('.meta_description') }
%>

Adding these inside of a frame doesn’t cause them to be updated when navigating frames tho. But I didn’t look into what a “minimal layout” is yet.

Edit:

I defined my own layouts/turbo_rails/frame.html.erb based on that PR and modified it to be this for a quick test:

<html>
  <head>
    <meta name="alternative" content="present" />
    <%= yield :head %>
    <title><%= yield :title %></title>
    <meta name="description" content="<%= yield :meta_description %>">
  </head>
  <body>
    <%= yield %>
  </body>
</html>

Then I added this inside of one of the frames:

  <%
    content_for(:title) { 'index' }
    content_for(:meta_description) { 'cool' }
  %>

Unfortunately it didn’t update upon page transition.

Although I am using a custom layout, if I explicitly reference this new frame layout then it updates.

My custom layout has:

<% content_for :content do %>
  <main>
    <p>A whole bunch of things are here, which I omit for the sake of this post.</p>
  </main>
<% end %>

<%= render template: 'layouts/application' %>

If I replace application with turbo_rails/frame then it updates but then the pages are missing a bunch of content since it’s not using my custom layout.