Skip to content
New issue

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

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

Already on GitHub? # to your account

Do not cache the drop payload for SeoTag #306

Merged
merged 3 commits into from
Mar 16, 2019
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
15 changes: 14 additions & 1 deletion lib/jekyll-seo-tag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,20 @@ def payload
end

def drop
@drop ||= Jekyll::SeoTag::Drop.new(@text, @context)
# TODO: Modify following comment once Jekyll 4.0 ships.
# ------------------------------------------------------------------------------------------
# Jekyll 4.0 is probably going to cache parsed Liquid Templates which is going to break the
# rendered output from this tag since there's going to be just a single instance of this
# class per {% seo %} in a template, (especially when the tag is used as part of an include).
# -------------------------------------------------------------------------------------------
#
# FIXME: Switch to using `if Gem::Version.new(Jekyll::VERSION) >= Gem::Version.new("4.0.0")`
# once Jekyll 4.0 ships.
if context.registers[:site].liquid_renderer.respond_to?(:cache)
Jekyll::SeoTag::Drop.new(@text, @context)
else
@drop ||= Jekyll::SeoTag::Drop.new(@text, @context)
end
end

def info
Expand Down