juusaw / amp-jekyll

Build Accelerated Mobile Page versions of your Jekyll posts
MIT License
281 stars 59 forks source link

Loop through collections #28

Open gbreux opened 7 years ago

gbreux commented 7 years ago

Hi there,

Would it be possible to also loop through all collections and pages instead of posts only?

I think it can be interesting :)

I tried to add

      site.collections.each do |collection|
        collection.docs.each do |post|
          next if post.data['skip_amp'] == true
          site.pages << AmpPost.new(site, site.source, File.join(dir, post.id), post)
        end
      end

But as my knowledge in ruby is super limited, it failed (collection.docs doesn't exist) so maybe you can see a better workaround?

Thanks