This is by far the easiest way to create a comment section / guestbook for your website. You only have to use google Sheets and App scripts with a super minimal setup. -----
First, create a spreadsheet to store your comments:
Guestbook
(or any name you like).Timestamp
, Name
, and Comment
.Now, we’ll set up a script to handle storing and fetching comments.
function doPost(e) {
const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
const data = JSON.parse(e.postData.contents);
// Add a new row with the comment data
sheet.appendRow([new Date(), data.name, data.website, data.comment]);
return ContentService.createTextOutput("Comment added!");
}
function doGet() {
const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
const data = sheet.getDataRange().getValues();
const comments = data.slice(1).map(row => ({
timestamp: row[0],
name: row[1],
website: row[2],
comment: row[3]
}));
return ContentService.createTextOutput(JSON.stringify(comments))
.setMimeType(ContentService.MimeType.JSON);
}
Me
and Who has access to Anyone
.Now, embed this in your Neocities site:
body {
font-family: 'Arial', monospace;
background-color:black;
}
/* Comment Form Styling */
#commentForm {
background: black; /* White background for the form */
padding: 30px;
border-radius: 3px;
margin-bottom: 20px;
border: px solid deeppink;
width:50%;
}
#commentForm input[type="text"],
#commentForm input[type="url"],
#commentForm textarea {
/* Full width */
padding: 6px;
margin-bottom: 6px;
border: 1px solid deeppink; /* Light border */
border-radius: 4px; /* Slightly rounded edges */
font-size: 16px;
background-color:black;
}
#commentForm textarea {
resize: none; /* Allow vertical resizing */
min-height: 100px; /* Minimum height */
width: 100%;
}
#commentForm button {
background: black; /* Blue button */
color: deeppink; /* White text */
border: solid deeppink 1px;
padding: 10px 20px;
border-radius: 4px;
cursor: pointer; /* Pointer cursor on hover */
font-size: 16px;
transition: background 0.3s ease; /* Smooth hover effect */
}
#commentForm button:hover {
box-shadow: deeppink 0px 0px 9px 0px;
border: solid white 1px;
color: white; on hover */
}
/* Comments Display Styling */
#comments {
margin-top: 20px;
}
.comment {
background: black; /* White background for each comment */
padding: 15px;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); /* Subtle shadow */
margin-bottom: 15px;
border: 1px solid deeppink; /* Light border */
}
.comment h3 {
margin: 0 0 10px; /* Space below the name */
font-size: 18px;
color: deeppink; /* Blue name */
}
.comment p {
margin: 0 0 10px; /* Space below the comment */
font-size: 16px;
color: white; /* Slightly lighter text for comments */
}
.comment small {
display: block; /* Make timestamps and links block-level */
font-size: 10px;
color: deeppink; /* Light gray for metadata */
}
.comment a {
color: hotpink; /* Blue link */
text-decoration: none; /* No underline */
transition: color 0.3s ease; /* Smooth hover effect */
}
.comment a:hover {
color: white; /* Darker blue on hover */
text-decoration: underline; /* Underline on hover */
}
/* Responsive Design */
@media (max-width: 600px) {
#commentForm input[type="text"],
#commentForm input[type="url"],
#commentForm textarea {
font-size: 14px; /* Smaller font on mobile */
}
.comment h3 {
font-size: 16px; /* Smaller name on mobile */
}
.comment p {
font-size: 14px; /* Smaller comment text on mobile */
}
}
Email
or Rating
by updating the Google Sheet and script.And that’s it! You now have a working Guestbook on your Neocities!