@AntonKhorev commented on this pull request.


> @@ -76,5 +76,13 @@ document.addEventListener("DOMContentLoaded", function () {
       const data = parent.OSM.mapParams();
       goToLocation(data);
     });
+
+    const firstParentTitle = parent.document.title;
+    new MutationObserver(function (mutations) {
+      if (!mutations.some(mutation => mutation.target.tagName === "TITLE")) 
return;
+      const newTitle = `${document.title} | ${firstParentTitle}`;
+      if (parent.document.title === newTitle) return;
+      parent.document.title = newTitle;
+    }).observe(document.head, { childList: true, subtree: true });

You have to observe `document.head` because there's no title element initially. 
However if you `<title>` to `app/views/site/id.html.erb`, you'll be able to 
observe it right away. Even an empty title should work.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5865#discussion_r2020224432
You are receiving this because you are subscribed to this thread.

Message ID: 
<openstreetmap/openstreetmap-website/pull/5865/review/2727978...@github.com>
_______________________________________________
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev

Reply via email to