Fix injecting metadata into HTML pages
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
eef5a9ff23
commit
893e2296b3
@ -18,11 +18,8 @@ defmodule Mobilizon.Web.Views.Utils do
|
|||||||
end
|
end
|
||||||
|
|
||||||
@spec replace_meta(String.t(), String.t()) :: String.t()
|
@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
|
defp replace_meta(index_content, tags) do
|
||||||
index_content
|
String.replace(index_content, "<meta name=\"server-injected-data\">", tags)
|
||||||
|> String.replace("<meta name=\"server-injected-data\" />", tags)
|
|
||||||
|> String.replace("<meta name=server-injected-data>", tags)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@spec do_replacements(String.t(), String.t(), String.t()) :: {:safe, String.t()}
|
@spec do_replacements(String.t(), String.t(), String.t()) :: {:safe, String.t()}
|
||||||
@ -30,7 +27,6 @@ defmodule Mobilizon.Web.Views.Utils do
|
|||||||
index_content
|
index_content
|
||||||
|> replace_meta(tags)
|
|> replace_meta(tags)
|
||||||
|> String.replace("<html lang=\"en\">", "<html lang=\"#{locale}\">")
|
|> String.replace("<html lang=\"en\">", "<html lang=\"#{locale}\">")
|
||||||
|> String.replace("<html lang=en>", "<html lang=\"#{locale}\">")
|
|
||||||
|> (&{:safe, &1}).()
|
|> (&{:safe, &1}).()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user