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

Blog caching #507

Closed
lucassmagal opened this issue Sep 7, 2012 · 18 comments
Closed

Blog caching #507

lucassmagal opened this issue Sep 7, 2012 · 18 comments

Comments

@lucassmagal
Copy link

Hello guys,

I have, finally, deployed my blog. I'm still hacking the theme, but almost everything is fine, except one thing: browser page caching.

How are you dealing with it?

@justinmayer
Copy link
Member

Hi Lucas. I haven't had any issue with browser page caching, so there hasn't been anything for me to deal with. Why don't you hop onto IRC via either...

... where it will be easier to help you. Thanks!

@onlyhavecans
Copy link
Contributor

Are you referring to, when developing a theme how do deal with the fact that the browser caches artifacts, forcing you to HARD reload every time or not see your changes?

This is the universal developers query and there is many ways of dealing with it. I use a program called coda, which is a web ide that has a debugging browser that never caches. Cheaper solutions include developer plugins for your favorite browser, or debug mode (like in safari) which has a disable caches options

@justinmayer
Copy link
Member

No IRC love. Like a jilted paramour, my heart is in tatters. 😞

FWIW, I use Safari in regular, non-debug mode, and all I need to do is a normal page reload to update the cached assets. I serve the files locally via python -m SimpleHTTPServer and http://localhost:8000/ instead of viewing files directly in the browser. (e.g., file:///mysite/index.html)

@sigmavirus24
Copy link
Contributor

I know that feel @justinmayer. I also always test locally before deploying it with the simple server that python has so I don't encounter this either with Firefox.

@onlyhavecans
Copy link
Contributor

Sorry for trying to be helpful!!! sigh ;p
The develop_server.sh script init's both python's simple server and pelican auto-reload in debug mode. I wrote this because those two combined I found perfect for theme development

@lucassmagal
Copy link
Author

No, I'm not having problems with browser caching during development, the problem is when the code is deployed... currently I'm using heroku with ruby's Rack TryStatic middleware.

@justinmayer
Copy link
Member

Hmm. As the BunnyMan said in his original comment, there's nothing about browser asset caching that's specific to Pelican. Perhaps the Heroku or Rack communities would be better positioned to help.

In any case, this sounds like a Rack config issue. Do you have static asset caching enabled anywhere? Anything like this?

require "rack/contrib/static_cache"
use Rack::StaticCache, [...]

@onlyhavecans
Copy link
Contributor

So you deploy but old content is still being displayed?
I've never had or heard of a problem like that before.

I'm inexperienced with heroku so I can't help, sorry.

@lucassmagal
Copy link
Author

@tbunnyman , yes, I can only see the new content with a hard reload =S

@justinmayer , no, I'm not aware of these Rack configurations. Is there anyone using Rack to serve a pelican blog or it's just me?

@onlyhavecans
Copy link
Contributor

I know someone other than yourself has mentioned it but no complaints.

@honzajavorek
Copy link
Contributor

I deployed my Pelican to GitHub pages and this also happened to me. Browser cached my statically served pages and I had to perform hard reload to get the newest document. As I generated some little stuff by cron on daily basis (list of events), it was not very nice, because my visitors had seen expired list of events from yesterday until they hardrefreshed the page (but no normal person does this, really). As there is no way to change the way GitHub serves static pages (e.g. HTTP headers, I think you could adjust them to somehow prevent such behaviour, at least for often-changing pages), I finally decided to move it to Heroku - I turned the list of events into a proper, dynamic Python/Flask Heroku app.

@lucassmagal
Copy link
Author

@honzajavorek , that's what I'm trying to do now... I'm changing some Ruby/Rack configurations to see what can solve this kind of problem.

So... what's your Flask app? Can you share this code with me?

@honzajavorek
Copy link
Contributor

@lucassmagal I actually completely rewritten the whole thing into normal dynamic app. So it's not a solution for you. I had a list of events generated by cron into a static page. I turned it into full-featured dynamic Flask app with views, the list of events is generated on request now.

@lucassmagal
Copy link
Author

@honzajavorek , it seems a interesting approach, even it's not a solution for me, I'm really curious about it.

@honzajavorek
Copy link
Contributor

@lucassmagal Well, look here for the original app: https://github.com/honzajavorek/zitkino Now I am trying to turn it into proper app. It's not done yet, I develop it in https://github.com/honzajavorek/zitkino/tree/standalone-app.

@justinmayer
Copy link
Member

I think this discussion has run its course. Issue closed.

@eamonnfaherty-productmadness

I am having the same issue.

I am deploying to github pages using travisci and I have to hard reload the home page to see the most up to date version.

Is there any solution to this?

@justinmayer
Copy link
Member

@eamonnfaherty-productmadness: This doesn't have anything to do with Pelican. Moreover, what you are describing sounds, to me, the way browser caching is designed to work. I don't understand what the perceived problem is.

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

6 participants