Show Disqus at the bottom of .html format blog post

I have created a post in Rmarkdown for my Jekyll website. The post is in filename.html. The post appears the way I want it to be on Jekyll.

The blog post is called Data_Science_with_R_Pt_1.html, I have put this file into my _posts folder. My other blog posts are .md files and the Disqus section appears without any problem. My disqus.html is saved in _includes folder.

I am pretty new to Jekyll, so is there a way to show this Disqus section with a post in filename.html format?

I’d like it to look like this.


Can you post what you have tried? I’m not real clear on what you are saying - it works if the post is a markdown file but not if it is an html file?

Is the discus code in a layout? include?

I have updated the post.

I’ve put {% include disqus.html %} at the bottom of the Data_Science_with_R_Pt_1.html, Disqus appears but it is out of place.

Do you have the date at the beginning of that file name in the _posts folder? it probably wouldn’t be the problem but without the date I don’t think it would show up.

So the comments show up and are functional, they just aren’t displaying correctly when the post is html vs md?

If so that just sounds like your html is throwing off something, maybe there is a missing closing tag or extra div or something.

Also, you probably should be calling the include from a layout, that way you wouldn’t have to add it to the bottom of every post. Are the md posts doing this the same way?

Have you looked at it with the inspector in the browser?

is there a live site to look at? and repo?

I have the date in the right format for the .html post. And yes Disqus and footer icons aren’t displaying correctly if the blog post is saved as html.

The md posts are fine. They show up in Jekyll as I want them to be.

This is the repo for the website

Thank you so much for responding to my questions!

Can you link to the page on the rendered site that is wrong? I don’t see it - I only see the md version in your source. You do have an html file in the _posts folder but I don’t think that is what you are asking about right?

This is the link to the one that is wrong

Link to the html

ah, well that file is a full html file as if it was downloaded off a working website - I’m not even sure how the disqus comments are even there as it doesn’t look like you have front matter, which means jekyll should not be doing anything other than copying it to the _site folder.

If you want to use that content I would spend some time removing everything except the actual article and then run it thru the same layout as the others.

If you look at the disqus section in your source, you have it at the very bottom which is after the actual html page has closed:


<!-- Disqus -->
{% if site.theme_settings.disqus_shortname %}
<div class="comments">
  {% include disqus.html %}
{% endif %}

<!-- Post navigation -->
{% if site.theme_settings.post_navigation %}
  {% include post_nav.html %}
{% endif %}

Yup that’s exactly what I want to do. Have the article to appear like it is but have the table of content on the side and then have the Disqus and tags appear at the bottom.

This is what I have tried so far. Close but the toc is now out of place. Thank you!

is this just one page that you want to do or will there be a bunch that are like this?

I think you have your work cut out for you, I would stop using the entire html page from the old site and focus on the content/article on the page, probably looking at the View Page Source you get when you right click on the original page in the browser. I would ditch everything except the content/article stuff - so the head and footer and everything would be gone.

This will break everything and then you need to figure out how to get the js and css to work again. In the end it will be a lot cleaner and make more sense.

At a minimum I would strip out all the jibberish in there - I think it is sourcemap stuff? 90% of that file is just random characters and is muddling it up.

I suppose if this is the only page like this you can eventually hack it to get there as you are, it just isn’t very jekyll-y.

There will be a lot more posts. For now I might just use the whole html and provide a link in the article for continuity in the series of the post, until I figure out how to make it work.

And thanks a lot! :slight_smile: