Talkyard+Ghost Selfhosted Error on Theme Reload
Hi,
I have self hosted instances of Ghost and Talkyard on separate servers. Followed the instructions provided here 3.
Noticed couple of issues:
-
Documentation says comment code snippet to be included in: section class=“post-full-comments”
But post.hbs has only: section class=“article-comments gh-canvas”Does the documentation need update and is this the correct place to plug in the integration code?
-
On pasting the code snippet in this section, theme throws an error on reload. In Ghost log, the following error is found:
{“checkedVersion”:“4.x”,“name”:“casper”,“path”:"/var/www/content/content/themes/casper",“version”:“4.3.0”,“errors”:[{“fatal”:true,“level”:“error”,“rule”:“Templates must contain valid Handlebars”,“details”:“Oops! You seemed to have used invalid Handlebars syntax. This mostly happens, when you use a helper that is not supported.
See the full list of available helpers here.”,“failures”:[{“ref”:“post.hbs”,“message”:"Parse error on line 76:\n… {{ <section class=“arti\n---------------------^\nExpecting ‘ID’, ‘STRING’, ‘NUMBER’, ‘BOOLEAN’, ‘UNDEFINED’, ‘NULL’, ‘DATA’, got ‘INVALID’”}],“code”:“GS005-TPL-ERR”}]}
ThemeValidationError: Theme “casper” is not compatible or contains errors.Is there any change in the embed code that needs to be made for compatibility?
Appreciate your inputs.
Thanks,
Jim
- KajMagnus @KajMagnus2022-01-07 09:28:42.745Z
There are people who use Ghost + Talkyard, however, I don't know if maybe these are issues for them too. Or maybe nowadays new bloggers try out G + Ty and then abandon Ty, because of this.
Seems I might need to re-read the Ghost docs, and look for changes in more recent Ghost versions, maybe install Ghost locally to try this out, hope to have time ... hmm, next week or the week after
Hi @KajMagnus ,
Thanks for your response. Wanted to followup and check if you got around to checking this. Happy to help with testing and validating any inputs.
Thanks,
JimKajMagnus @KajMagnus2022-01-29 13:24:42.301Z
Having a look now. (Thanks for the reminder :- ) Didn't know (or had forgotten that) there was a Docker image so it was easy to get Ghost running on localhost)
Indeed, seems the docs is out-of-date. In Ghost v4.34 I see this:
{{!-- <section class="article-comments gh-canvas"> If you want to embed comments, this is a good place to paste your code! </section> --}}
that is, class "
article-comments gh-canvas
" instead of "post-full-comments
". ... Later today I'll see if I can reproduce the errorKajMagnus @KajMagnus2022-01-29 14:48:18.316Z
Hi @jim, now I've tested a bit more — works for me ...
... So I was wondering if maybe you could copy-paste the relevant Handlebars & HTML snippets, from your Ghost theme configuration?
If there's nothing sensitive / private in the Casper theme's
post.hbs
file (seems you use Casper, looking at the error message in the Orig Post),
maybe you could attach the whole file, or send to me via a direct message? (click my name)***
Here's the comments section of my
post.hbs
, now when I'm testing on localhost, Ghost v4.34.0:
(I left the "If you want to embed ..." comment intact, doesn't matter)<section class="gh-content gh-canvas"> {{content}} </section> <div class="gh-canvas"> <p>TESTING_TESTING, comments below</p> </div> {{!-- <section class="article-comments gh-canvas"> If you want to embed comments, this is a good place to paste your code! </section> --}} <section class="article-comments gh-canvas"> <script>talkyardServerUrl='http://site-rtksb2ku03.localhost';</script> <script async defer src="http://comments-for-e2e-test-embcomman-localhost-8080.localhost/-/talkyard-comments.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="{{comment_id}}" style="margin-top: 45px;"> <noscript>Please enable Javascript to view comments.</noscript> <p style="margin-top: 25px; opacity: 0.9; font-size: 96%">Comments powered by <a href="https://www.talkyard.io">Talkyard</a>.</p> </div> </section> </article> </main>
For this to work, with Ghost listening on port 2368, I went here:
/-/admin/settings/embedded-comments
(in Talkyard), and configured:Allow embedding from:
http://localhost:2368
- In reply tojim⬆:KajMagnus @KajMagnus2022-01-29 17:08:50.850Z2022-01-29 17:15:38.344Z
Looking closely at the error message in the Orig Post, it seems as if there's an accidental newline in the middle of a HTML attribute, something like this, on line 76:
{{<section class=“arti ---------------------^
But should be: (and the
{{!--
and--}}
should be removed — seems there's still a{{
left)<section class="article-comments gh-canvas">
Edit: Or maybe the
---------^
"arrow" looking line, points out the error — maybe the error message was:Oops! You seemed to have used invalid Handlebars syntax ... on line 76: {{<section class=“arti ---------------------^
Then, the problem could be that you accidentally forgot to remove
{{
. Note that there might be}}
at the end of the comments block to remove too :- ) (or--}}
)) - JIn reply tojim⬆:@jim
@KajMagnus Thanks much for your response. I will test based on your inputs. Couple of quick questions:
- My setup involves Ghost and Talkyard on separate servers. Please let me know if this changes anything in your responses (e.g. localhost)
- Also, how will sign-ons be treated. Is there a TY setting to reuse/ redirect sign-in info from Ghost or vice versa.
Your support is much appreciated.
Thanks,
JimKajMagnus @KajMagnus2022-02-03 17:03:49.829Z
Hi @jim,
1) This changes nothing — things work the same as before. Seems you got most of it right, just one "template typo" problem (the
{{
brackets).2a) Single sign-on from Ghost to Talkyard: Not currently possible. There is no Ghost membership integration (unfortunately). From what I've seen, the Ghost software doesn't make this possible in a secure way. Instead, it's a work in progress, on their Enterprise hosting plan, see: https://forum.ghost.org/t/third-party-single-sign-on-sso/3321
Talkyard does support blog comments single sign-on, using PASETO tokens, however, there's no way to generate and sign these tokens, without editing the Ghost blog backend code, and hosting Ghost yourself.
2b) Single sign-on from Talkyard: Hmm in a way, yes, in that if you also used the same Talkyard site as a forum, then people could log in and post blog comments, using their logins from the forum (and the other way around).