-
Notifications
You must be signed in to change notification settings - Fork 288
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
fix jekyll 4.0 cache mismatch errors #182
base: master
Are you sure you want to change the base?
Conversation
Jekyll 4.0 introduced a new caching mechanism to the LiquidRenderer class. This remembers the paths of any files passed to convert and the rendered output. The cache is reset between repeat invocations of `Site.process' it's really only to prevent needing to re render templates or includes. The cache works by remembering the file name of any files being rendered, returning the cached value on demand should jekyll try to render a file with the same path (from the src directory) multiple times. The issue here is that Jekyll-Paginate-V2 sets the name of all `Jekyll::PaginateV2::Generator::PaginationPage` instances to index.html. Meaning every pagination page gets rendered to the result of the first paginated page. This patch simply assigns some fields the Page instance, such that it appears to have the same file name as the file to which it's written to (which should guarantee it's uniqueness and prevent liquid cache mismatches).
@@ -41,6 +42,8 @@ def initialize(page_to_copy, cur_page_nr, total_pages, index_pageandext) | |||
end | |||
|
|||
def set_url(url_value) | |||
@path = url_value.delete_prefix '/' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Caution: String#delete_prefix
was added only in Ruby 2.5. Therefore, this will break on older Ruby versions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this seem better to you?
if path[0] == '/'
path[1..]
end
@mohkale Can you post the |
Kay, will get on it soon. |
@ashmaroli I've attached to this the before and after log and also a zip of the site. The site has two collections ( |
@mohkale The before and after diff shows: - Rendering: .html
- Pre-Render Hooks: .html
- Rendering Liquid: .html
- Rendering Markup: .html
- Rendering Layout: .html
+ Rendering: bar/.html
+ Pre-Render Hooks: bar/.html
+ Rendering Liquid: bar/.html
+ Rendering Markup: bar/.html
+ Rendering Layout: bar/.html
Layout source: site
- Rendering: .html
- Pre-Render Hooks: .html
- Rendering Liquid: .html
- Rendering Markup: .html
- Rendering Layout: .html
+ Rendering: foo/.html
+ Pre-Render Hooks: foo/.html
+ Rendering Liquid: foo/.html
+ Rendering Markup: foo/.html
+ Rendering Layout: foo/.html
|
@ashmaroli could you clarify what you mean? do you mean the filename ( |
Yes. Or some other unique name. |
I'm planning to switch from jekyll to hugo, so I'm not sure when (or if) I'll get back round to trying to fix this. If someone wants to try to do so, feel free 😄. |
hi, I'll give it a shot 😄 Thanks for your work! |
Jekyll 4.0 introduced a new caching mechanism to the LiquidRenderer class. This remembers the paths of any files passed to convert and the rendered output.
The issue here is that Jekyll-Paginate-V2 sets the name of all
Jekyll::PaginateV2::Generator::PaginationPage
instances to index.html. Meaning every pagination page gets rendered to the result of the first paginated page.This patch simply assigns some fields the Page instance, such that it appears to have the same file name as the file to which it's written to (in the _site directory).