Commit beb8f1c9 authored by Takuya Noguchi's avatar Takuya Noguchi

Remove "Details" from breadcrumb item and JSON+LD from Project top

Reduces the size of JSON+JD
Signed-off-by: default avatarTakuya Noguchi <takninnovationresearch@gmail.com>
parent 064cc44e
- container = @no_breadcrumb_container ? 'container-fluid' : container_class - container = @no_breadcrumb_container ? 'container-fluid' : container_class
- hide_top_links = @hide_top_links || false - hide_top_links = @hide_top_links || false
- push_to_schema_breadcrumb(@breadcrumb_title, breadcrumb_title_link) - unless @skip_current_level_breadcrumb
- push_to_schema_breadcrumb(@breadcrumb_title, breadcrumb_title_link)
%nav.breadcrumbs{ role: "navigation", class: [container, @content_class] } %nav.breadcrumbs{ role: "navigation", class: [container, @content_class] }
.breadcrumbs-container{ class: ("border-bottom-0" if @no_breadcrumb_border) } .breadcrumbs-container{ class: ("border-bottom-0" if @no_breadcrumb_border) }
...@@ -16,8 +17,10 @@ ...@@ -16,8 +17,10 @@
- @breadcrumbs_extra_links.each do |extra| - @breadcrumbs_extra_links.each do |extra|
= breadcrumb_list_item link_to(extra[:text], extra[:link]) = breadcrumb_list_item link_to(extra[:text], extra[:link])
= render "layouts/nav/breadcrumbs/collapsed_dropdown", location: :after = render "layouts/nav/breadcrumbs/collapsed_dropdown", location: :after
- unless @skip_current_level_breadcrumb
%li %li
%h2.breadcrumbs-sub-title= link_to @breadcrumb_title, breadcrumb_title_link %h2.breadcrumbs-sub-title
= link_to @breadcrumb_title, breadcrumb_title_link
%script{ type:'application/ld+json' } %script{ type:'application/ld+json' }
:plain :plain
#{schema_breadcrumb_json} #{schema_breadcrumb_json}
......
- @content_class = "limit-container-width" unless fluid_layout - @content_class = "limit-container-width" unless fluid_layout
- default_branch_name = @project.default_branch || "master" - default_branch_name = @project.default_branch || "master"
- breadcrumb_title _("Details") - @skip_current_level_breadcrumb = true
- page_title _("Details")
= render partial: 'flash_messages', locals: { project: @project } = render partial: 'flash_messages', locals: { project: @project }
......
- breadcrumb_title _("Details") - page_title _('No repository')
- page_title _("Details") - @skip_current_level_breadcrumb = true
%h2.gl-display-flex %h2.gl-display-flex
.gl-display-flex.gl-align-items-center.gl-justify-content-center .gl-display-flex.gl-align-items-center.gl-justify-content-center
......
- breadcrumb_title _("Details")
- @content_class = "limit-container-width" unless fluid_layout - @content_class = "limit-container-width" unless fluid_layout
- @skip_current_level_breadcrumb = true
= content_for :meta_tags do = content_for :meta_tags do
= auto_discovery_link_tag(:atom, project_path(@project, rss_url_options), title: "#{@project.name} activity") = auto_discovery_link_tag(:atom, project_path(@project, rss_url_options), title: "#{@project.name} activity")
......
---
title: Remove "Details" from breadcrumb item and LD+JSON from Project top
merge_request: 47817
author: Takuya Noguchi
type: changed
...@@ -15,15 +15,12 @@ RSpec.describe 'Breadcrumbs schema markup', :aggregate_failures do ...@@ -15,15 +15,12 @@ RSpec.describe 'Breadcrumbs schema markup', :aggregate_failures do
item_list = get_schema_content item_list = get_schema_content
expect(item_list.size).to eq 3 expect(item_list.size).to eq 2
expect(item_list[0]['name']).to eq project.namespace.name expect(item_list[0]['name']).to eq project.namespace.name
expect(item_list[0]['item']).to eq user_url(project.owner) expect(item_list[0]['item']).to eq user_url(project.owner)
expect(item_list[1]['name']).to eq project.name expect(item_list[1]['name']).to eq project.name
expect(item_list[1]['item']).to eq project_url(project) expect(item_list[1]['item']).to eq project_url(project)
expect(item_list[2]['name']).to eq 'Details'
expect(item_list[2]['item']).to eq project_url(project)
end end
it 'generates the breadcrumb schema for group projects' do it 'generates the breadcrumb schema for group projects' do
...@@ -31,7 +28,7 @@ RSpec.describe 'Breadcrumbs schema markup', :aggregate_failures do ...@@ -31,7 +28,7 @@ RSpec.describe 'Breadcrumbs schema markup', :aggregate_failures do
item_list = get_schema_content item_list = get_schema_content
expect(item_list.size).to eq 4 expect(item_list.size).to eq 3
expect(item_list[0]['name']).to eq group.name expect(item_list[0]['name']).to eq group.name
expect(item_list[0]['item']).to eq group_url(group) expect(item_list[0]['item']).to eq group_url(group)
...@@ -40,9 +37,6 @@ RSpec.describe 'Breadcrumbs schema markup', :aggregate_failures do ...@@ -40,9 +37,6 @@ RSpec.describe 'Breadcrumbs schema markup', :aggregate_failures do
expect(item_list[2]['name']).to eq group_project.name expect(item_list[2]['name']).to eq group_project.name
expect(item_list[2]['item']).to eq project_url(group_project) expect(item_list[2]['item']).to eq project_url(group_project)
expect(item_list[3]['name']).to eq 'Details'
expect(item_list[3]['item']).to eq project_url(group_project)
end end
it 'generates the breadcrumb schema for group' do it 'generates the breadcrumb schema for group' do
......
...@@ -78,14 +78,14 @@ RSpec.describe 'Profile > Account', :js do ...@@ -78,14 +78,14 @@ RSpec.describe 'Profile > Account', :js do
update_username(new_username) update_username(new_username)
visit new_project_path visit new_project_path
expect(current_path).to eq(new_project_path) expect(current_path).to eq(new_project_path)
expect(find('.breadcrumbs-sub-title')).to have_content('Details') expect(find('.breadcrumbs')).to have_content(user.name)
end end
it 'the old project path redirects to the new path' do it 'the old project path redirects to the new path' do
update_username(new_username) update_username(new_username)
visit old_project_path visit old_project_path
expect(current_path).to eq(new_project_path) expect(current_path).to eq(new_project_path)
expect(find('.breadcrumbs-sub-title')).to have_content('Details') expect(find('.breadcrumbs')).to have_content(user.name)
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment