yizeng / jekyll-theme-simple-texture

A gem-based responsive simple texture styled Jekyll theme.
https://yizeng.github.io/jekyll-theme-simple-texture/
MIT License
189 stars 216 forks source link

Mixed scheme error on browsers when blog is over HTTPS #12

Closed shadyabhi closed 6 years ago

shadyabhi commented 6 years ago

Hi,

First of all, thanks for providing this awesome theme. I see an issue in code at https://github.com/yizeng/jekyll-theme-simple-texture/blob/master/_includes/common/disqus.html#L27, it tries to load embed.js over http all the time no matter what's the url specified in _config.yaml. Hence, if my blog is over HTTPS, comments don't load.

What's the right way to fix this?

Thanks

yizeng commented 6 years ago

@shadyabhi

Hello! Thanks for contacting.

Yes, I think it's better to replace it with https here at https://github.com/yizeng/jekyll-theme-simple-texture/blob/master/_includes/common/disqus.html#L27.

So it will be

$.getScript('https://' + disqusShortname + '.disqus.com/embed.js');

Would that solve your problem?

I'm not sure what you mean by url specified in _config.yaml though, here is what I use in my _config.yml.

disqus:
  shortname: yizeng
  public_key: ULZ0b9TFdfCUJSKQd4WCKv2v3u25YoG7YG8zXPewkWrT35lZ0Se9YnxLzoV6VM8W
yizeng commented 6 years ago

@shadyabhi

I have made a fix. Please upgrade and let me know how it goes! Thank you.

You only need to change this file if you are using a fork. https://github.com/yizeng/jekyll-theme-simple-texture/pull/13/files#diff-77446f103b36b06356129abc6ab0530d

shadyabhi commented 6 years ago

Hi,

Thanks for fixing that. I was hoping that you will make a fix by reading the url value from _config.yaml.

➜ $?=0 @arastogi-mn3 data/blog.abhi.host_site [ 8:05AM] (master|✚75…)➤ cat _config.yml | yq .url
"https://blog.abhi.host"

>>>  0s elasped...
➜ $?=0 @arastogi-mn3 data/blog.abhi.host_site [ 8:05AM] (master|✚75…)➤
yizeng commented 6 years ago

@shadyabhi

That's why I was confused about. url is the url for your site, which disqus doesn't need.

Am I missing anything here?

shadyabhi commented 6 years ago

@yizeng

Sorry for the confusion. If we set scheme for disqus URL as https all the time, absolutely no issues. :) It's all good. Thanks for working on that.

My initial thought was, if the scheme in url is http, we'll set the http url for disqus, else https. But, keeping it always https is not an issue at all.

Thanks

yizeng commented 6 years ago

@shadyabhi Good 👍

yizeng commented 6 years ago

@shadyabhi The actual fix I made and merged is to use whatever protocol is right now. Like this:

$.getScript('//' + disqusShortname + '.disqus.com/embed.js');

https://stackoverflow.com/questions/9646407/two-forward-slashes-in-a-url-src-href-attribute