3 ms·
We made a static site generator that goes over ANY dynamic and renders a bunch of URLs to static HTML in the “same folder” for purposes of referencing relative
by EGreg 6y ago
We made a static site generator that goes over ANY dynamic and renders a bunch of URLs to static HTML in the “same folder” for purposes of referencing relative paths for resources.
We had two main issues... one is that links to dynamic pages would need to either be rewritten to static ones, or the dev ops would have to our 301 redirects for the list of dynamic URLs which we rendered, to the corresponding static html pages.
The other issue is that various aspects of the page would be related to authenticated sessions, and should NOT appear in the static site generated resources.
Any ideas about these issues?
- kayodelycaon 6y agoYou could solve some of this by having a small script as a fallback. PHP would be my goto; it's pretty fast for simple things. Another alternative is to have your generator create an nginx config with the redirects. (W3 Total Cache for Wordpress does something like this)
- neurostimulant 6y agoWhy not serve the generated static content from a different domain? Assuming all links to the dynamic pages are relative, you don't need to rewrite the urls that way. Alternatively just update the crawler to rewrite any url that matches certain rules. As for hiding certain element, maybe appending some simple css to the generated pages to hide them is enough? something like `.login-form {display: none !important;}`