This is a custom Squarespace infrastructure for Hope in a Box's website.
Hope in a Box is a non-profit dedicated to helping teachers at rural and/or low-income schools include LGBTQ+ books in their classroom. This infrastructure helps teachers browse Hope in a Box's curated list of 100 inclusive books with an interactive page for searching and filtering books). We do this by generating a static HTML page using pre-scraped data, without the use of any database or backend.
The structure of this repository adheres to Squarespace's template format, which is specified here. The important files are:
pages/browse-books.page
: the HTML and CSS for the book list page.scripts/booklist-data.js
: a pre-generated JSON file masquerading as a JS file that contains data for all books.scripts/inflate-booklist.js
: a script that ingests data frombooklist.js
and inflates the page.
The book list page's search functionality uses fuzzyset by Glen Chiacchieri.
- Clone this repository to a local machine.
- Push this repository to the remote address as specfied by your own Squarespace site.
- Run
node fetch-booklist-data.mjs
to scrape book data from a database or a spreadsheet into the format as specified inscripts/booklist-data.js
. This script uses private keys that are not included in the repository. If you would like to use the fetching script with your own spreadsheet, you'll need to create a developer key for the Google Sheets API and follow the endpoint here. If you would like to use our data, please get in touch. - Ensure that
assets/book-covers/
contains the covers of every book, formatted in kebab case. - Push the repository to the Squarespace remote.