move large blobs out of `<head>` (#6428)
it unnecessarily bloats the section and increases the payload dramatically for open graph tags.
This commit is contained in:
parent
70d74f8fc1
commit
819f090d6a
|
@ -55,9 +55,6 @@
|
|||
<%= render partial: "common/discourse_stylesheet" %>
|
||||
<%= render partial: "common/special_font_face" %>
|
||||
|
||||
<meta id="data-preloaded" data-preloaded="<%= preloaded_json %>">
|
||||
<%= preload_script "preload-application-data" %>
|
||||
|
||||
<%= yield :head %>
|
||||
|
||||
<%= build_plugin_html 'server:before-head-close' %>
|
||||
|
@ -107,6 +104,9 @@
|
|||
</form>
|
||||
<% end %>
|
||||
|
||||
<div class="hidden" id="data-preloaded" data-preloaded="<%= preloaded_json %>">
|
||||
<%= preload_script "preload-application-data" %>
|
||||
|
||||
<%= yield :data %>
|
||||
|
||||
<%= render :partial => "common/discourse_javascript" %>
|
||||
|
|
|
@ -32,7 +32,7 @@ describe CategoriesController do
|
|||
SiteSetting.categories_topics.times { Fabricate(:topic) }
|
||||
get "/categories"
|
||||
|
||||
expect(response.body).to have_tag("meta#data-preloaded") do |element|
|
||||
expect(response.body).to have_tag("div#data-preloaded") do |element|
|
||||
json = JSON.parse(element.current_scope.attribute('data-preloaded').value)
|
||||
expect(json['topic_list_latest']).to include(%{"more_topics_url":"/latest"})
|
||||
end
|
||||
|
|
|
@ -190,7 +190,7 @@ describe UsersController do
|
|||
)
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(response.body).to have_tag("meta#data-preloaded") do |element|
|
||||
expect(response.body).to have_tag("div#data-preloaded") do |element|
|
||||
json = JSON.parse(element.current_scope.attribute('data-preloaded').value)
|
||||
expect(json['password_reset']).to include('{"is_developer":false,"admin":false,"second_factor_required":false,"backup_enabled":false}')
|
||||
end
|
||||
|
@ -258,7 +258,7 @@ describe UsersController do
|
|||
|
||||
get "/u/password-reset/#{token}"
|
||||
|
||||
expect(response.body).to have_tag("meta#data-preloaded") do |element|
|
||||
expect(response.body).to have_tag("div#data-preloaded") do |element|
|
||||
json = JSON.parse(element.current_scope.attribute('data-preloaded').value)
|
||||
expect(json['password_reset']).to include('{"is_developer":false,"admin":false,"second_factor_required":true,"backup_enabled":false}')
|
||||
end
|
||||
|
@ -2615,7 +2615,7 @@ describe UsersController do
|
|||
|
||||
expect(response.status).to eq(200)
|
||||
|
||||
expect(response.body).to have_tag("meta#data-preloaded") do |element|
|
||||
expect(response.body).to have_tag("div#data-preloaded") do |element|
|
||||
json = JSON.parse(element.current_scope.attribute('data-preloaded').value)
|
||||
expect(json['accountCreated']).to include(
|
||||
"{\"message\":\"#{I18n.t("login.activate_email", email: user.email).gsub!("</", "<\\/")}\",\"show_controls\":true,\"username\":\"#{user.username}\",\"email\":\"#{user.email}\"}"
|
||||
|
|
Loading…
Reference in New Issue