Skip to content
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

Jekyll 4.x - Map tag included in layout issue #46

Open
ghost opened this issue Jul 25, 2020 · 1 comment
Open

Jekyll 4.x - Map tag included in layout issue #46

ghost opened this issue Jul 25, 2020 · 1 comment

Comments

@ghost
Copy link

ghost commented Jul 25, 2020

Hello,
I noticed an strange issue occurring only on Jekyll 4+ and if the map tag is included directly in a layout file: the map is showing the location of the current post + the posts before.
Map of first post will be correct, map of second post will display map from first post and second post, etc.
image
image

The issue is not occurring when inserting the tag directly in the post content or using jekyll 3.x. Is this something about the new jekyll cache feature?

I created a repository to reproduce the issue easily: https://github.com/Gerfaut/jekyll-maps-issue
Is there anything we can do on the jekyll-maps gem to fix that or is this meant to work like that?

Thanks a lot for your help,
Gerfaut

@ghost ghost changed the title Jekyll 4.0 - Map tag included in layout issue Jekyll 4.x - Map tag included in layout issue Jul 26, 2020
@chtitux
Copy link

chtitux commented Nov 29, 2022

I believe this is because class GoogleMapTag < Liquid::Tag is always created on every tag rendering.
Hence, LocationFinder instance is kept between pages to render, and @documents is not cleaned.

To fix it, you have to ensure LocationFinder is created from scratch on every GoogleMapTag.render invocation.

The change #50 should fix the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant