Skip to content

Commit

Permalink
Merge pull request #210 from SwedbankPay/feature/dx-1288_tweaks
Browse files Browse the repository at this point in the history
DX-1288: Always hide search from the sidebar, even from itself
  • Loading branch information
asbjornu authored Dec 1, 2020
2 parents 4f09a4f + 60dbefa commit a76a87e
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
5 changes: 5 additions & 0 deletions lib/sidebar_page.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ def hidden?
end

def hidden_for?(other_page)
if @jekyll_page.data['layout'] == 'search'
# Never show the search result page in the menu.
return true
end

# The current page should be hidden for the other page unless the
# other page is also hidden.
hidden = hidden?
Expand Down
1 change: 0 additions & 1 deletion search.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
title: Search
layout: search
hide_from_sidebar: true
---
21 changes: 21 additions & 0 deletions spec/sidebar_search_file_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# frozen_string_literal: true

require 'sidebar'

describe SwedbankPay::Sidebar do
include_context 'shared'
search_path = File.join(@dest_dir, 'search.html')

describe search_path do
subject { File.read(search_path) }

it {
expect(File).to exist(search_path)
}

it 'does not have search item' do
is_expected.not_to have_tag('.main-nav-ul span', text: 'Search')
is_expected.not_to have_tag('.main-nav-ul a[href="/search"]')
end
end
end

0 comments on commit a76a87e

Please sign in to comment.