Skip to content

Commit 982091a

Browse files
committed
Get path for first page of paginated pages (fixes #213)
1 parent 21e9a05 commit 982091a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lib/jekyll-github-metadata/edit-link-tag.rb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ def self.def_hash_delegator(hash_method, key, method, default = nil)
3535
private def_hash_delegator :site_github, :source, :source, {}
3636
private def_hash_delegator :source, :branch, :branch
3737
private def_hash_delegator :source, :path, :source_path
38-
private def_hash_delegator :page, :path, :page_path
3938

4039
def render(context)
4140
@context = context
@@ -72,6 +71,16 @@ def parts
7271
memoize_conditionally { [repository_url, "edit/", branch, source_path, page_path] }
7372
end
7473

74+
def page_path
75+
return page['path'] unless page['paginated']
76+
77+
site.pages.dup.select do |page|
78+
if page.pager and page.pager.page == 1
79+
return page['path']
80+
end
81+
end
82+
end
83+
7584
def parts_normalized
7685
memoize_conditionally do
7786
parts.map.with_index do |part, index|

0 commit comments

Comments
 (0)