[openstreetmap/openstreetmap-website] set <title> upon search (#2347)

Sam Jenkins notifications at github.com
Sun Aug 11 11:07:03 UTC 2019


Hi @tomhughes! Have updated initial comment with an example.

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.

It also works with XHR requests. The `set_title` function (see `title_helper.rb`) takes a string argument and assigns it to `@title`. It also runs the following line:
```
response.headers["X-Page-Title"] = ERB::Util.u(@title + " | " + t("layouts.project_name.title"))
```
which attaches the updated title to the XHR response.
In the browser, `index.js` lines 70-71 use `"X-Page-Title"` to set `document.title`.

Would be very grateful if you could flag any unexpected behaviour!

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/2347#issuecomment-520219345
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20190811/cda517aa/attachment.html>


More information about the rails-dev mailing list