Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quotes in titles break Disqus comments #421

Closed
alxmjo opened this issue Apr 3, 2020 · 2 comments
Closed

Quotes in titles break Disqus comments #421

alxmjo opened this issue Apr 3, 2020 · 2 comments

Comments

@alxmjo
Copy link
Contributor

alxmjo commented Apr 3, 2020

When I use quotes in my titles, the JavaScript at the end of the file renders like this:
var disqus_title = '"Conway's Game of Life with an Arduino and an 8x8 LED Array"';

This throws Uncaught SyntaxError: Unexpected identifier and prevents Disqus from loading at all.

Here's the offending line:

var disqus_title = {{ page.title | jsonify }};

I found that if I change jsonify to escape then it works correctly.

Code in post.html: var disqus_title = '{{ page.title | escape }}';

Now it renders like so:
var disqus_title = 'Conway's Game of Life with an Arduino and an 8x8 LED Array';

And Disqus loads correctly.

I'm happy to submit a pull for this if others think that it's an improvement.

@ashawley
Copy link
Collaborator

ashawley commented Apr 5, 2020

Is the title in your preamble the following?:

title: "Conway's Game of Life with an Arduino and an 8x8 LED Array"

When I try enabling disqus, I see the following in the HTML:

var disqus_title      = "Conway's Game of Life with an Arduino and an 8x8 LED Array";

That seems fine, and it loads Disqus at the bottom of the page.

Is there something I'm doing differently?

@alxmjo
Copy link
Contributor Author

alxmjo commented Apr 5, 2020

You're correct. This is my error. I was working off an older version of Pixyll in which disqus_title is surrounded by single quotes. It works fine without them, so I just need to update my own copy of the code. Thanks for the catch.

@alxmjo alxmjo closed this as completed Apr 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants