From 8c910f5fd3180c2cc0cb796760caa55bd27ea014 Mon Sep 17 00:00:00 2001 From: Jarrett Lusso Date: Fri, 15 Mar 2024 17:21:03 -0400 Subject: [PATCH] Remove page number in title This is not needed and breaks the built in pagination title handling. --- lib/bridgetown-seo-tag/drop.rb | 12 ------------ spec/bridgetown_seo_tag/drop_spec.rb | 20 -------------------- 2 files changed, 32 deletions(-) diff --git a/lib/bridgetown-seo-tag/drop.rb b/lib/bridgetown-seo-tag/drop.rb index 867efaf..62c5f26 100644 --- a/lib/bridgetown-seo-tag/drop.rb +++ b/lib/bridgetown-seo-tag/drop.rb @@ -71,8 +71,6 @@ def title page_title || site_title end - return page_number + @title if page_number - @title end @@ -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 %s of %s for " - - format(paginator_message, current: current, total: total) if current > 1 - end - attr_reader :context def fallback_data diff --git a/spec/bridgetown_seo_tag/drop_spec.rb b/spec/bridgetown_seo_tag/drop_spec.rb index ac1ea09..eba1359 100644 --- a/spec/bridgetown_seo_tag/drop_spec.rb +++ b/spec/bridgetown_seo_tag/drop_spec.rb @@ -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" => "%s of %s" } } - - it "renders the correct page number" do - expect(subject.send(:page_number)).to eq("2 of 10") - end - end - end end