Skip to content

Commit

Permalink
Merge pull request #10 from jclusso/remove_page_number_in_title
Browse files Browse the repository at this point in the history
Remove page number in title
  • Loading branch information
jaredcwhite authored Mar 17, 2024
2 parents 9b97582 + 8c910f5 commit bc1fb05
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 32 deletions.
12 changes: 0 additions & 12 deletions lib/bridgetown-seo-tag/drop.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ def title
page_title || site_title
end

return page_number + @title if page_number

@title
end

Expand Down Expand Up @@ -189,16 +187,6 @@ def homepage_or_about?
page["url"] =~ HOMEPAGE_OR_ABOUT_REGEX
end

def page_number
return unless @context["paginator"] && @context["paginator"]["page"]

current = @context["paginator"]["page"]
total = @context["paginator"]["total_pages"]
paginator_message = site["seo_paginator_message"] || "Page %<current>s of %<total>s for "

format(paginator_message, current: current, total: total) if current > 1
end

attr_reader :context

def fallback_data
Expand Down
20 changes: 0 additions & 20 deletions spec/bridgetown_seo_tag/drop_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -501,24 +501,4 @@
end
end

context "pagination" do
let(:context) do
make_context(
{ page: page, site: site },
"paginator" => { "page" => 2, "total_pages" => 10 }
)
end

it "render default pagination title" do
expect(subject.send(:page_number)).to eq("Page 2 of 10 for ")
end

context "render custom pagination title" do
let(:site_config) { { "seo_paginator_message" => "%<current>s of %<total>s" } }

it "renders the correct page number" do
expect(subject.send(:page_number)).to eq("2 of 10")
end
end
end
end

0 comments on commit bc1fb05

Please sign in to comment.