mirror of
https://github.com/jekyll/jekyll.git
synced 2026-04-28 03:01:03 -04:00
@@ -39,38 +39,3 @@ You might want to have a particular folder structure for your source files that
|
||||
|
||||
From Jekyll 4.1.1 onwards, one can *choose* to generate excerpts for their pages by setting `page_excerpts` to `true` in their
|
||||
config file.
|
||||
|
||||
## Liquid Representation
|
||||
|
||||
From Jekyll 4.1 onwards, there is a minor change in how instances of `Jekyll::Page` are exposed to layouts and other Liquid
|
||||
templates. `Jekyll::Page` instances now use a `Liquid::Drop` instead of a `Hash`. This change results in greater performance
|
||||
for a site with numerous *standlone pages not within a collection*.
|
||||
|
||||
### For plugin developers
|
||||
|
||||
While end-users do not need to take any extra action due to this change, plugin authors depending on the existing behavior *may*
|
||||
need to make minor changes to their plugins.
|
||||
|
||||
If a `Jekyll::Page` subclass' `to_liquid` method calls `super`, it will have to be slightly modified.
|
||||
```ruby
|
||||
class Foo::BarPage < Jekyll::Page
|
||||
def to_liquid(*)
|
||||
payload = super # This needs to be changed to `super.to_h`
|
||||
# to obtain a Hash as in v4.0.0.
|
||||
|
||||
do_something(payload) # Logic specific to `Foo::BarPage` objects
|
||||
end
|
||||
end
|
||||
```
|
||||
|
||||
`Jekyll::Page` subclasses won't inherit the optimization automatically until the next major version. However, plugin authors
|
||||
can opt-in to the optimization in their subclasses by wrapping the temporary `liquid_drop` method if the subclass doesn't
|
||||
override the superclass method:
|
||||
```ruby
|
||||
class Foo::BarPage < Jekyll::Page
|
||||
def to_liquid(*)
|
||||
liquid_drop # Returns an instance of `Jekyll::Drops::PageDrop`.
|
||||
# Will be removed in Jekyll 5.0.
|
||||
end
|
||||
end
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user