Wrote an article on how I use Airtable with Jekyll

Here it is: mzrnsh › Using Airtable as a Jekyll website database

Short summary:

  • I fetch the latest records from Airtable at build time, and update the _data folder
  • I monitor changes in Airtable to trigger new deploys, thus when I make changes, I don’t need to rebuild manually
1 Like

thats pretty cool, thanks for sharing!

1 Like


First of all, I wanted to thank you for your useful article which allowed me to finally find a solution to use a database with our static website (I was beginning to despair).
However, when I run the jekyll plugin, the yaml data file is only updated with 100 randomly picked entries of the table. I checked Airtable doc and there is an API record limit of 100, afterwhich another request must be made. Would you know how to ask the plugin to make multiple requests (one per page) in order to display all the records?

Thank you in advance for your reply!

1 Like

I found the answer to my own question in the airtable plugin’s documentation: all records can be queried through a series of batch request, by replacing

  data = table.records.map(&:attributes)


  data = table.all.map(&:attributes)
1 Like

Glad you figured it out! Mind sharing the full code snippet that deals with those batches? You should somehow paginate them, right?

Yes sorry, I realise now my former message wasn’t clear at all!

I just changed one line in the jekyll plugin airtable.rb you display in your guide: instead of querying a set of records using records, I queried all using… all. Here is the full code:

require 'dotenv/load'
require 'airtable'
require 'active_support/all'

airtable = Airtable::Client.new(ENV['AIRTABLE_API_KEY'])
table = airtable.table(ENV['AIRTABLE_BASE'], ENV['AIRTABLE_TABLE'])

File.open("_data/#{ENV['AIRTABLE_TABLE']}.yml", 'w') do |file|
  data = table.all.map(&:attributes)
  warning = "# Do not edit this file manually \n"

  file.write(warning, data.to_yaml)

Using all allows you to query all the rows of your table without paginating it, it just updates the _data folder with all the content of your table.

Another method could work, by getting the offset parameter at the end of each page of 100 rows you get with records, but then you’d have to multiply queries in order to loop through all the “pages” of your table (as it is explained in Airtable doc)


Ah, my bad! Thought all returns batches of 100, not all records in a single batch. Good to know, thanks for doing the research for us.

1 Like