buren / wayback_archiver

Ruby gem to send URLs to Wayback Machine
https://rubygems.org/gems/wayback_archiver
MIT License
57 stars 11 forks source link

Jekyll integration #39

Closed xplosionmind closed 3 years ago

xplosionmind commented 3 years ago

It would be awesome to automate the process of saving all the pages of a Jekyll website to the Wayback Machine every time the website is deployed.

I suppose it would be quite simple to make it a Jekyll plugin

buren commented 3 years ago

Hi @xplosionmind,

I haven't created a Jekyll plugin before and it was a long time ago since I last touched a Jekyll site in general.

I quickly looked at Jekylls deployment documentation and you can build the site locally first with JEKYLL_ENV=production bundle exec jekyll build, which would generate the site to a _site/ subfolder. It that case it would make no sense trying to archive the site, since nothing has been deployed yet.

Instead, if you use automated deployment, what I'd think would be better is to run wayback_archiver as a part of the deployment pipeline.

So for example in Jekylls Circle CI example I would add a step after "Upload to s3" that would run wayback_archiver <url-to-site>. For the best result I'd also make sure to be using the plugin jekyll-sitemap, that way wayback_archiver would find and use the sitemap and all URLs will be properly archived.

Hope that helps.

xplosionmind commented 3 years ago

Thank you very much! Your suggestions have been very helpful.

buren commented 3 years ago

Glad I could help!