Draft
Conversation
✅ Deploy Preview for ferretosan-web ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Co-authored-by: Ferretosan <129646624+Ferretosan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add Utterances comments for blog posts in popup
Add Utterances comments to blog post popups
Mar 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Blog posts loaded in the popup had no comments system. Adds Utterances (GitHub Issues-backed, no ads) comments to each post popup.
Changes
js/markdown-parser.jsUTTERANCES_REPO/UTTERANCES_THEMEconfig constants at the top with TODO instructionsaddUtterancesComments(filename)— injects the Utterances<script>viacreateElement(required; scripts viainnerHTMLdon't execute), keyed onissue-term="blog/<filename>"for a stable, unique-per-post GitHub Issue mappingloadBlogPost()immediately afterpopupwindowstart(html)style/popup.css#utterances-container: adds a top-border separator and forces the Utterances iframe to 100% popup widthREADME.mdConfiguration
Each post maps to a GitHub Issue titled
blog/<filename>(e.g.blog/newyear26.md), created automatically on first comment.Original prompt
Set up Utterances comments for blog posts in Ferretosan/web.
Context:
blog/*.md.loadBlogPost(filename)injs/markdown-parser.js, which fetchesblog/${filename}, parses Markdown to HTML, and callspopupwindowstart(html).Requirements:
innerHTMLdo not execute (common with popup rendering). Therefore, inject Utterances via DOM (createElement('script')).issue-termmapping strategy based on the blog filename (e.g.,issue-term="title"with a stable title likeblog/<filename>orissue-term="pathname"if feasible). Avoid relying on the hash alone if it can change.js/markdown-parser.jsfor the Utterances repo and theme, with clear TODO instructions.UTTERANCES_REPO(and optionally theme)Acceptance criteria:
Files likely to change:
js/markdown-parser.jsREADME.mdstyle/if needed.The following is the prior conversation context from the user's chat exploration (may be truncated):
User: @Ferretosan/web i want to add comments to my blog posts. how could i go about doing that? please observe the code first
Assistant: I looked at your repo. Your “blog posts” are Markdown files in
blog/*.md, and they get opened in a popup viajs/markdown-parser.js(loadBlogPost()fetchesblog/${filename}and then callspopupwindowstart(html)). So the simplest place to add comments is right after the post HTML is rendered (inside that popup).3 practical ways to add comments
1) Easiest (no backend): embed a comment service per post
Add a small “comments” HTML block after
popupwindowstart(html)inloadBlogPost(). Common options:This keeps your site static and avoids building your own database/login.
2) Still simple: store comments in a GitHub Issue (write via API)
Each post maps to an issue; users submit comments that become issue comments. You’ll need a small server/proxy to avoid exposing tokens (or accept “open GitHub issue” links instead of inline posting).
3) Full custom comments (hardest): your own backend + database
You’d build endpoints like:
GET /api/comments?post=newyear26POST /api/comments(name + message + anti-spam)Where to put it in your code
In
js/markdown-parser.js, modifyloadBlogPost(filename)so it appends a comments container using the post’s hash/filename as the unique ID.Quick question (so I recommend the right approach)
Do you want anyone to comment without accounts, or are you okay requiring a GitHub account (Giscus/Utterances)?
User: i dont want ads on my website. and i tried giscus and failed horribly. i need a disqus alternative.
Assistant: If you want no ads, skip Disqus (their free tier is ad-supported) and use a self‑hostable comment system.
Best Disqus alternatives (no ads)
1) Remark42 (recommended)
<div>+ 1<script>2) Isso
3) Commento (community edition)
How it plugs into your code
Your blog post HTML is injected here:
So you add comments by append...
This pull request was created from Copilot chat.
💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.