Fix title on load of Pleroma HTML
authorSean King <seanking2919@protonmail.com>
Sun, 8 Nov 2020 23:16:20 +0000 (16:16 -0700)
committerSean King <seanking2919@protonmail.com>
Sun, 8 Nov 2020 23:16:20 +0000 (16:16 -0700)
lib/pleroma/web/fallback/redirect_controller.ex

index 6f759d559648cc2cb9ebe34f40ce15102d6ebf9e..712991c1888d3e4deca00ac90502e47ffeb43c7e 100644 (file)
@@ -37,9 +37,11 @@ defmodule Pleroma.Web.Fallback.RedirectController do
 
     tags = build_tags(conn, params)
     preloads = preload_data(conn, params)
+    title = "<title>#{Pleroma.Config.get([:instance, :name])}</title>"
 
     response =
       index_content
+      |> String.replace(~r/<title>.+?<\/title>/, title)
       |> String.replace("<!--server-generated-meta-->", tags <> preloads)
 
     conn
@@ -54,9 +56,11 @@ defmodule Pleroma.Web.Fallback.RedirectController do
   def redirector_with_preload(conn, params) do
     {:ok, index_content} = File.read(index_file_path())
     preloads = preload_data(conn, params)
+    title = "<title>#{Pleroma.Config.get([:instance, :name])}</title>"
 
     response =
       index_content
+      |> String.replace(~r/<title>.+?<\/title>/, title)
       |> String.replace("<!--server-generated-meta-->", preloads)
 
     conn