Releases: jdvp/jekyll-comments-google-forms
v2.2.0
Features
Comment Caching
Comment data is now cached for 1 hour after a successful GET call retrieves comment data while using the AppsScript method. This cache is cleared in any of the following scenarios:
- An hour elapses
- A new comment is added via API
- The underlying spreadsheet or form are updated manually
- An error occurs when either adding or retrieving comments
This caching seems to significantly speed up comment retrieval when the cached data is available as opposed to reading the underlying spreadsheet
Without Caching Enabled | Cache Miss + Subsequent Cache Hits | All Cache Hits |
---|---|---|
Average: 1.616s | Average: .9222s | Average: .858s |
In order to do the test above, I wrote the following script to curl
the URL 10 times and take the average time it took to get the response
Click to see script
#!/bin/bash
url="$@"
printf "Testing average speed of URL: $url\n"
singleRequest() {
curl --location -w @- -o /dev/null -s "$@" <<'EOF'
%{time_total}
EOF
}
numRuns=10
total=0
for ((i=1; i<=$numRuns; i++)); do
result=$(singleRequest "$url")
printf "Run $i took $result seconds\n"
total=$(echo "$total + $result" | bc)
done
printf "Total time for $numRuns runs: $total seconds\n"
average=$(echo "$total / $numRuns" | bc -l)
printf "average time for $numRuns runs: $average seconds\n"
For reference, the article I was testing has around 80 comments at the time of me testing and caching cut the time to load the comments almost in half.
Going forward I want to see if I can shave off any more time because in the app script editor, running the GET call takes like 30ms so something weird seems to be going on with how app script APIs force redirects and stuff.
Caching will be enabled by default going forward and can be turned off by setting the CACHING_ENABLED
variable in Code.gs
to false
Small reCAPTCHA update
Instead of commenting out reCAPTCHA code, it is now flagged off by whether or not the API key is null. This is to enable faster development time on my end by not having to figure out what is changed in my test version used for my personal site and the version maintained in this repository. I.e this change ensures I only have to provide my reCAPTCHA key but can keep the rest of the file the same while testing
Bugs
- Fixed an issue where comments with only numbers would cause comments to not display at all
Full Changelog: v2.1.0...v2.2.0
v2.1.0
Adds the following functionality to the comment-section.html file:
- Comment Replies - ability to reply to other comments and jump directly to the other comments to get more context.
See this article for more details and configuration options: Using Google Forms for Jekyll Comments, Revisited. This option is specifically mentioned in the January 29 update.
v2.0.0
Adds the following functionality to the comment-section.html
file:
- Chunked Comment Loading
- Lazy Loading Comments
- Ability to use Google Apps Scripts as an API instead of using unsupported hidden APIs for Google Forms and Google Sheets
- Ability to use reCAPTCHA if using Google Apps Scripts
See this article for more details and configuration options: Using Google Forms for Jekyll Comments, Revisited
v1.0.0
Initial(ish) version of the comment-section.html file.
This supports basic addition of comments to a jekyll site as seen in Using Google Forms for Jekyll Comments