Closed Kobzol closed 4 years ago
I'd rather add an "etag" to individual courses (https://github.com/pyvec/naucse/issues/28). A timestamp for the whole page will work for a statically generated website, but it would be harder to implement is naucse is dynamic.
It would be better to do it for courses individually, but right now if I understand correctly, naucse is generated as a static website and projekty.pyladies.cz fetches all data and can't check courses individually. So the timestamp is a quick fix (let's say for the current spring courses), until the system is reworked.
For the static website you might be able to use commit.sha
from https://api.github.com/repos/pyvec/naucse.python.cz/branches/gh-pages
See #33 for the "etag" solution.
Ok, let's skip the intermediate step and use etags directly. This will require a larger rewrite of pyladies-courseware, but at least we don't have to make the change in multiple steps. Thanks! I'm therefore closing this issue.
Adds a UNIX timestamp to the generated website, so that it can be used by remote sites (like https://github.com/messa/pyladies-courseware) to invalidate their caches if something changes.
The timestamp is global for the whole website to keep it simple (pyladies-courseware fetches the whole website in one go, so this change is enough to solve its caching problem).
If you want to use a hash instead, we could add a simple postprocessing step to
naucse
, which would hash thev0
directory after the website is frozen and create a file containing the hash inside thev0
directory.Related issues: https://github.com/pyvec/naucse/issues/28, https://github.com/messa/pyladies-courseware/issues/165