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

GMaps Javascript library not loading with caching on after first use #24

Open
hughbris opened this issue Jul 26, 2017 · 3 comments
Open

Comments

@hughbris
Copy link

This may be the same or related to #22 but I can't be sure from its description. I apologise that my problem description may also be vague and difficult to reproduce. It has been tricky to pin it down to a pattern. I'll try to describe my environment comprehensively, please let me know if more info is required.

The behaviour I see is that when I enable caching on a page with maps, the map (and library) load the first time, but not on subsequent refreshes - obviously I see a blank div where the map should be. The javascript code is not included in the source. This is easy to work around for individual pages (using cache_enable in frontmatter but it would be better to find the cause :)

I have extended your plugin to add support for map Places shortcodes but I don't think my extensions modify any original plugin code. (When I have time to make the code more generic, I will submit my fork with new features as a pull request.)

Asset pipeline settings seem to make no difference, as I originally thought that was the problem.

I'm running Grav on nginx with the following plugins, all up to date:

  • Admin Panel
  • Data Manager
  • DevTools
  • Email
  • Error
  • Featherlight
  • Form
  • Google Analytics
  • LightSlider
  • Login
  • Maintenance
  • Markdown Notices
  • Problems
  • Shortcode Core
  • Sitemap

I also have three custom plugins but none of them use Javascript at the moment. I'm extending the Antimatter theme.

Hope that helps. Please let me know if you require more details.

@miraculli
Copy link

I have the same experience so I decide to add the google-maps JS-lib by twig {% do assets.addJs ... %} within the page.
This shows the same behavour like discribed in the issue.
Everything works finde with chache_enable = flasefor this page.

@ferino75
Copy link

I have the same problem.
After disable cache for this page its working OK, but isnt optimal solution...

@thgh
Copy link

thgh commented Oct 16, 2017

The problem seems to be that Google doesn't want you to host the Maps javascript. I resolved this issue once and for all by replacing the addAssets() with a hardcoded script tag in the template.

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

4 participants