How to add Talkyard comments to a SquareSpace blog
(This not yet tested — please leave a comment below if you try this out?)
Squarespace has a built-in commenting system — however if for some reason you want to use Talkyard instead, you could try this:
-
Go to Squarespace's "custom code injection" settings, see: https://support.squarespace.com/hc/en-us/articles/205815908-Using-Code-Injection. Try to find Squarespace's Post Blog Item Code Injection in the Blog Page settings — that's where you'll add the Talkyard HTML tags including a Javascript
<scrip>
tag. — Aparently you need to be on Squarespace's "Business and Commerce" price plan (because of the script tag). -
Once you've found the Post Blog Item Code Injection field, and verified that it's editable, sign up for Talkyard, the "Almost Free" price plan, and choose Blog Comments (or install on your own server).
-
Select "Something else" when asked about what blog platform you use.
-
You'll see some HTML tags — copy-paste that into Squarespace's Post Blog Item Code Injection field, and save.
Thereafter, hopefully Talkyard comments will appear below your blog post pages. Does it work for you?
Linked from:
- B@brightside
Since the last time I talked to you, I've inserted the code into two blog posts (Friday and Monday). I'm happy to say that it worked and that my readers were willing to use it. I did come across two problems, however.
-The Friday post lost some of the comments. What's left is people wondering where the comments went.
-When I access my website (and the latest post), I see comments from Friday's post. When I click on the same post in the "latest post" list (and change the URL in the process), I get the actual comments.
I think there's a separate comment section for the website's URL (https://dimandbright.com/) and the URLs of individual blog posts (https://dimandbright.com/comics/comic-168-a-computocrary-rises). Did I do something wrong? How do I make it so that blog posts determine the comment section and not the URLs?- KajMagnus @KajMagnus2021-05-20 05:06:33.574Z2021-05-20 05:16:20.145Z
There's a Squarespace template variable you can use as discussion id:
{squarespace.page-id}
— then, the comments will should the same (won't disappear), regardless of on which URL the blog post is shown.(sorry for the late reply)
So, should look something like this: (look at the
data-discussion-id=
)<script>talkyardServerUrl='https://kajmagnus-blog.talkyard.io';</script> <script async defer src="https://tyw-49f8.kxcdn.com/-/talkyard-comments.min.js"></script> <!-- You can specify a per page discussion id on the next line, if your URLs might change. --> <div class="talkyard-comments" data-discussion-id="{squarespace.page-id}" <——— style="margin-top: 45px;"> ... </div>
Squarespace docs: https://developers.squarespace.com/json-t-system-variables (I found by searching for "squarespace template variables")
Don't know if you would want to find and move the lost comments, to the correct discussion page, so they'll be "found" and back again? Then I could write a bit about how to do that.
- B@brightside
I've been looking at your instructions for a while, but I still don't know what to do. Can you be more specific?
It's probably my fault. Like I said, I don't know anything about coding.
- KajMagnus @KajMagnus2021-05-22 05:18:26.759Z2021-05-22 05:31:31.687Z
Hmm. When you added Talkyard comments to the Squarespace blog, then, at some point, you copy-pasted the above HTML snippets into a Squarespace Post Blog Item Code Injection field?
If you open those settings again — see https://support.squarespace.com/hc/en-us/articles/205815908-Using-Code-Injection, you'll see this?:
<script>talkyardServerUrl='....'</script> ... <div class="talkyard-comments" ...
And then, on the
<div class="talkyard-comments" ....
line, edit it so it includes this:data-discussion-id="{squarespace.page-id}"
That whole line will then look something like:
<div class="talkyard-comments" data-discussion-id="{squarespace.page-id}" style="margin-top: 45px;"> </div>
Thereafter, Talkyard will use the Squarespace page ID, instead of the page URL, to know which comments to show.
However initially this might mean all comments temporarily disappear, because the comments, up until now, have been matched with the blog post URL, there was previously no discussion id.
So it will look as if all comments suddenly disappeared, I'd think. (Hmm I ought to have mentioned this.)
- KajMagnus @KajMagnus2021-05-22 05:31:38.562Z
@brightside Would it be okay if I log in as superadmin to your Squarespace comments site, and have a look at the blog post URLs and discussion IDs? There's some functionality in Talkyard for editing URLs and discussion IDs, to handle situations like this.
- B@brightside
Okay, I've tested out the new comment section and it still didn't work. Now, the comments are the same on every blog post. We could fix it again, but I don't know if my readers would trust me. Most of them are still using the old comment section.
I don't think Talkyard is right for me and my website. That being said, I want to compensate you for all the trouble you went. I won't use Talkyard, but I'll rent it for a few months anyway.
- KajMagnus @KajMagnus2021-05-30 17:04:33.814Z
Now, the comments are the same on every blog post.
That indicates that the following page id variable substitution somehow doesn't work:
data-discussion-id="{squarespace.page-id}"
— because if Squarespace somehow interprets{squarespace.page-id}
as a page ID itself (instead of replacing it with an actual page ID, like123ABC
),then what you're seeing, would happen (or, if there is no
data-discussion-id
, and the blog posts appear on the same URL).***
If one day you (and your readers) would like to try Talkyard again, then I'm thinking that before that, I should sign up for a free trial Squarespace plan, and try out the Squarespace templating system myself, and write better docs. I suppose it'd also, in that theoretical scenario, be good if you posted two comments test blog posts just to see that the comments appeared correctly.
(No need to pay any rent — thanks anyway. Sorry for the troubles)
- In reply toKajMagnus⬆:B@brightside
Okay, I changed the code and there's no more comments on the home page. Other blog posts also lost their comments, but I guess that's because the code changed. The layout of my website changed with it, but the changes were either fixable or too minute to matter.
I'll make a new blog post this Monday, inform the readers about the code change and ask them to try it out. We'll see if all the kinks have been ironed out.
You've been a great help, but I'd rather be the only person with admin privileges on my website. I'm sorry, I hope you understand.