To add fake live comments to a specific post on Blogspot, you'll need to:
1. Add the JavaScript code to the post's HTML.
2. Use a unique identifier for the comments container.
Here's the updated code:
_Fake Comments Code for Blogspot Post_
```
// Fake comment data
var comments = [];
var maxComments = 100;
var commentInterval = 5000; // 5 seconds
var postId = "POST-ID-HERE"; // Replace with your post ID
// Function to generate random name
function getRandomName() {
var names = ["John Doe", "Jane Doe", "Bob Smith", "Alice Johnson", "Mike Brown"];
return names[Math.floor(Math.random() * names.length)];
}
// Function to generate random comment
function getRandomComment() {
var commentsList = ["Great post!", "Love this!", "Well said!", "Nice article!", "Thanks for sharing!"];
return commentsList[Math.floor(Math.random() * commentsList.length)];
}
// Function to display comments
function displayComments() {
var commentHtml = "";
for (var i = 0; i < comments.length; i++) {
commentHtml += `
${comments[i].name}
${comments[i].comment}
${comments[i].time}
`;
}
document.getElementById(postId + "-comments").innerHTML = commentHtml;
}
// Function to add new fake comment
function addFakeComment() {
if (comments.length < maxComments) {
var newComment = {
name: getRandomName(),
comment: getRandomComment(),
time: Math.floor(Math.random() * 60) + " seconds ago"
};
comments.push(newComment);
displayComments();
}
}
// Initialize comments display
for (var i = 0; i < 10; i++) {
addFakeComment();
}
// Add new fake comment every 5 seconds
setInterval(addFakeComment, commentInterval);
```
_HTML Code (add to your post)_
```
```
Replace `POST-ID-HERE` with your actual post ID.
_Instructions_:
1. Go to your Blogspot post editor.
2. Switch to HTML view.
3. Add the JavaScript code before the `
Comments
Post a Comment