This guide will help you set up Firebase Realtime Database to enable global likes and comments for all visitors to your blog.
Your blog now includes Firebase integration that:
https://YOUR-PROJECT-ID-default-rtdb.firebaseio.com/Important: These rules prevent spam while allowing legitimate usage.
{
"rules": {
"likes": {
".read": true,
".write": true,
"$postId": {
"count": {
".validate": "newData.isNumber() && newData.val() >= 0 && newData.val() <= 99999"
},
"$other": {
".validate": false
}
}
},
"comments": {
".read": true,
".write": true,
".indexOn": "timestamp",
"$postId": {
".validate": "newData.hasChildren() && newData.numChildren() <= 50",
"$commentId": {
"name": {
".validate": "newData.isString() && newData.val().length > 0 && newData.val().length <= 50"
},
"text": {
".validate": "newData.isString() && newData.val().length > 0 && newData.val().length <= 500"
},
"date": {
".validate": "newData.isString() && newData.val().length <= 50"
},
"timestamp": {
".validate": "newData.isNumber() && newData.val() <= now"
},
"$other": {
".validate": false
}
}
}
},
"$other": {
".read": false,
".write": false
}
}
}
_layouts/post.html in your Jekyll sitedatabaseURL: 'https://YOUR_PROJECT_ID-default-rtdb.firebaseio.com/'
YOUR_PROJECT_ID with your actual project ID from Step 3https://my-blog-abc123-default-rtdb.firebaseio.com/, then update to:
databaseURL: 'https://my-blog-abc123-default-rtdb.firebaseio.com/'
bundle exec jekyll build && bundle exec jekyll serve
Visit a blog post and open browser dev tools (F12 → Console tab)
✓ DOM loaded, initializing like and comments system
✓ Loading global data...
✓ Attempting to load from Firebase...
✓ Loaded from Firebase: {...}
✓ System ready with Firebase integration!
likes and comments data appeargit add _layouts/post.html
git commit -m "Configure Firebase for global likes and comments"
git push
Deploy to your hosting platform (GitHub Pages, Netlify, Vercel, etc.)
Solution: Check that you replaced YOUR_PROJECT_ID with your actual project ID from Firebase.
Possible causes:
Check:
Check:
like-button, like-count, and comment form elementsTo modify limits, edit these values in _layouts/post.html:
maxlength="500" in HTML and validation rulesmaxlength="50" in HTML and validation rulesslice(-50) to your preferred limitFirebase Realtime Database free tier includes:
For a personal blog, this is typically more than sufficient. You can monitor usage in Firebase Console → Usage tab.
Your blog now has global likes and comments that work across all devices and browsers. Visitors can interact with your content, and their engagement will be visible to everyone.
Next steps you might consider: