<p>Hi <a class="user-mention" data-hovercard-type="user" data-hovercard-url="/hovercards?user_id=147741" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/tomhughes">@tomhughes</a>! Have updated initial comment with an example.</p>
<p>I have checked that it works in local dev environment. As you say, it certainly works when the URL is loaded with a query string.</p>
<p>It also works with XHR requests. The <code>set_title</code> function (see <code>title_helper.rb</code>) takes a string argument and assigns it to <code>@title</code>. It also runs the following line:</p>
<pre><code>response.headers["X-Page-Title"] = ERB::Util.u(@title + " | " + t("layouts.project_name.title"))
</code></pre>
<p>which attaches the updated title to the XHR response.<br>
In the browser, <code>index.js</code> lines 70-71 use <code>"X-Page-Title"</code> to set <code>document.title</code>.</p>
<p>Would be very grateful if you could flag any unexpected behaviour!</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/pull/2347?email_source=notifications&email_token=AAK2OLPEJ7EMJKHJXDSMRNLQD7XFPA5CNFSM4IK2RFD2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4A6VUI#issuecomment-520219345">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLMYMRQA2ZKM5EHCEJLQD7XFPANCNFSM4IK2RFDQ">mute the thread</a>.<img src="https://github.com/notifications/beacon/AAK2OLIVFI2SVKEN7ZB7OJTQD7XFPA5CNFSM4IK2RFD2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4A6VUI.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/pull/2347?email_source=notifications\u0026email_token=AAK2OLPEJ7EMJKHJXDSMRNLQD7XFPA5CNFSM4IK2RFD2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4A6VUI#issuecomment-520219345",
"url": "https://github.com/openstreetmap/openstreetmap-website/pull/2347?email_source=notifications\u0026email_token=AAK2OLPEJ7EMJKHJXDSMRNLQD7XFPA5CNFSM4IK2RFD2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4A6VUI#issuecomment-520219345",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>