Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include page number in title #250

Merged
merged 3 commits into from
Mar 8, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions lib/jekyll-seo-tag/drop.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ def title
page_title || site_title
end
end

if page_number
return page_number + @title
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it intentional that we are not memoizing this?


@title
end

def name
Expand Down Expand Up @@ -175,6 +181,17 @@ def homepage_or_about?
page["url"] =~ HOMEPAGE_OR_ABOUT_REGEX
end

def page_number
return if !@context["paginator"] || !@context["paginator"]["page"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd write this as return unless @context["paginator"] && @context["paginator"]["page"] to make the intent a bit more clear.


current = @context["paginator"]["page"]
total = @context["paginator"]["total_pages"]

if current > 1
return "Page #{current} of #{total} for "
end
end

attr_reader :context

def fallback_data
Expand Down