Skip to content

Trouble with a plugin #1757

Closed
trans opened this Issue Nov 25, 2013 · 13 comments

3 participants

@trans
trans commented Nov 25, 2013

Hi, I created this plugin called jekyll-transform. The intention of the plugin is to allow for a separate source location that has markdown files, but can't have normal front-matter (e.g. gollum wiki's files).

It seems to work fine --I can view post pages, but when I try to generate my index.html file with a list of blog entries, it's as if none of my posts exists. (Note: other than my plugin, I am using kippt/jekyll-incorporated to generate the site).

Any idea why {% for post in paginator.posts %} has nothing to iterate over?

@parkr
Jekyll member
parkr commented Nov 25, 2013

Hm. The paginator variable will only exist if these two conditions are met. Is the #paginate method being called?

@trans
trans commented Nov 25, 2013

Definitely the first condition. Though I was confused to see that https://github.com/mojombo/jekyll/blob/master/lib/jekyll/generators/pagination.rb#L103 is checking the size of pages and not posts.

I do not understand the second criteria. What is it searching for?

@trans
trans commented Nov 25, 2013

I put in some debug statements in the jekyll source to be sure. Both conditions are passing.

@parkr
Jekyll member
parkr commented Nov 25, 2013

The second criteria searches for a template page (the one which contains the references to paginator) based on the paginate_path. Does it find the right page?

L103 checks to make sure there is a page to use as a template :)

@trans
trans commented Nov 25, 2013

Ah. I see. I think it is finding the right page: #<Jekyll:Page @name="index.html">.

If I throw in {{ site.posts.size }} in the index.html template, it renders 69. So there are definitely posts in there.

@parkr
Jekyll member
parkr commented Nov 26, 2013

Hm, how strange. Is there a way I could take a look at your site?

What does {{ paginator }} output? Anything?

@trans
trans commented Nov 26, 2013

Here, I set up a repo: https://github.com/trans/transcode

Yea, {{ paginator }} shows nothing.

@trans
trans commented Nov 26, 2013

I think I figured out why it isn't working. Pagination is implemented as a generator, as is my plugin. So there is a priority issue -- Pagination#generate is begin called before my generator's #generate method is being called.

So the question is now, how to fix that?

@parkr
Jekyll member
parkr commented Nov 26, 2013

Great work! I'm sorry I wasn't able to take a look before you figured it out.

Perhaps we can modify the Paginator's priority to be set to :low?

@parkr
Jekyll member
parkr commented Nov 26, 2013

Looping @mattr- in to see if that's a 1.3.1 change.

@mattr-
Jekyll member
mattr- commented Nov 26, 2013

Yes, let's do it in 1.3.1.

@mattr- mattr- closed this in #1759 Nov 27, 2013
@trans
trans commented Nov 27, 2013

Awesome! Thank you so much for helping me work through this. I'll finally be able to get my blog up and running again! :-)

@parkr
Jekyll member
parkr commented Nov 27, 2013

Yay! Anything we can do to help! Sorry you encountered a bug :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.