Fix injecting metadata into HTML pages

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2020-10-08 10:41:30 +02:00
parent eef5a9ff23
commit 893e2296b3

View File

@ -18,11 +18,8 @@ defmodule Mobilizon.Web.Views.Utils do
end
@spec replace_meta(String.t(), String.t()) :: String.t()
# TODO: Find why it's different in dev/prod and during tests
defp replace_meta(index_content, tags) do
index_content
|> String.replace("<meta name=\"server-injected-data\" />", tags)
|> String.replace("<meta name=server-injected-data>", tags)
String.replace(index_content, "<meta name=\"server-injected-data\">", tags)
end
@spec do_replacements(String.t(), String.t(), String.t()) :: {:safe, String.t()}
@ -30,7 +27,6 @@ defmodule Mobilizon.Web.Views.Utils do
index_content
|> replace_meta(tags)
|> String.replace("<html lang=\"en\">", "<html lang=\"#{locale}\">")
|> String.replace("<html lang=en>", "<html lang=\"#{locale}\">")
|> (&{:safe, &1}).()
end