Could not get disqus to work with jekyll and git pages - jekyll

I am using Github Pages and Jekyll. I added the Disqus configuration but it could not appear on the posts.
I added disqus.html in the _includes directory. and added my disqus shortname into _config.yml.
Called {% include disqus.html %} from _layout/post.html.
Tried the comment:true option in the markdown files as well.
You may view my work at:
https://github.com/motleis/weekActivities
Thank you for your help.
EDIT: So far, I tried to converge the problem and noticed that {% if site.disqus %} is not evaluated to true. The only thing I can think of is filling the 'disqus' parameter in the _config.yml.
Any other things?

Finally I figured this out!!
"put your short-name inside quotation marks!"

Related

cant publish my boostrap page on github page

I published my website on Github page. for the second time. But error appears which I don't understand. I used bootstrap for my page, here is the error
"Your site is having problems building: A file was included in
bootstrap-3.3.7/docs/components.html that is a symlink or does not
exist in your _includes directory. For more information, see
https://help.github.com/articles/page-build-failed-file-is-a-symlink/."
here is my github repository https://github.com/makopa/portfolio
I had a similar issue while deploying on GitHub an old website built in 2017 with Bulma. After updating all my dependencies, I still got the same error as Makopa. I deleted the /docs folder, redeployed with git status, add, commit and push and it worked!
That bootstrap-3.3.7/docs/components.html does indeed have include directives:
{% include components/glyphicons.html %}
{% include components/dropdowns.html %}
{% include components/button-groups.html %}
And the help page does mention:
Search for the include tag to see where you've referenced other files. For example: {% include cool_header.html %}.
Copy or move any symlinked files into the _includes directory of your GitHub Pages repository.
Maybe you could simply not include the doc folder of the bootstrap framework (so delete it) in your repo.

Jekyll: parse pages without front matter

As far as I gather, Jekyll parses an included page through the templating stage if and only if it finds a YAML header / front matter. Otherwise it just copies it. Is there a way to force Jekyll to parse an included file without a front matter?
The rule of thumb is that Jekyll will not parse files without front matter.
However... there is a work-around. You can create an index.html file in the _includes directory without front matter. The Liquid in this file will be interpreted by Jekyll. You can render this include anywhere using:
{% include index.html %}
This solution is perfect for rendering HTML pages within a Jekyll context (without having the front matter requirement), especially when you want to reuse them. This could be useful for rendering a preview AND showing the code in a code block on another page. The include could be written in a layout file or in an index.md file.
Note that the included filename can be a variable (https://jekyllrb.com/docs/includes/):
{% if page.my_variable %}
{% include {{ page.my_variable }} %}
{% endif %}
Also note that if you want to show Liquid examples in this code, you should use:
{% raw %} ... Liquid example ... {% endraw %}
If you want a solution work-around for your specific situation, you should share your repository and explain your use case.

Jekyll does not modify files

I have a simple index.html which contains just {% include t.html %}
It is copied to _site as is, without substituting _includes/t.html
Other substitutions {{ }} do not work as well. How to debug and fix that?
One should add the front matter to the file to make Jekyll process it.

Jekyll plugin to handle categories doesn't work on GitHub

I've copied the Jekyll plugin to generate Category pages using an official source (https://github.com/recurser/jekyll-plugins) into my Github repository and it doesn't work, I keep on getting a 404 page. That said if I test on my local machine both in the Jekyll server and in the _site directory it works. Any ideas?
GitHub Pages does not support most plug-ins. They don't want anything crazy going on behind the scenes.
Here's how I do categories with Github Pages. It is not wholly automatic, as it requires a separate .html file for each category you want to set up. But it works without any plugins or wizardry on Github Pages.
Create a categoryname.html file in your root directory. For example, hardware.html for a Hardware category. Run a for loop on all of the site's posts and check the post.category
<div class="posts">
{% for post in site.posts %}
{% assign author = site.authors[post.author] %}
{{ author.display_name }}
{% if post.category == 'Hardware' %}
<div class="post">
<h1 class="post-title">
{{ post.title }}
</h1>
{{ post.content }}
</div>
{% endif %}
{% endfor %}
</div>
In your posts, you would use the YAML header to add the category to the post. Like the code below:
---
layout: post
title: How We Built a Hardware Product
author: Author Name
category: Hardware
---
That should do it. It'll create a /hardware/ page that will include all of your posts with the Hardware category. Make sure you're case-sensitive on your YAML and category names (hardware != Hardware and category != Category).
Another possible solution:
If you don't want to generate your site locally and push the created HTML files to GitHub (like David Jacquel suggested in his answer), you can create one single page with all categories.
Check out this answer:
An easy way to support tags in a jekyll blog
(Note: I'm using tags instead of categories there, but both work exactly the same way in Jekyll as far as I know. So you can just take my code and replace site.tags by site.categories)
I admit, one page per category looks nicer, but my solution has the advantage that it works on Github Pages (because it's just vanilla Liquid, no plugin).
EDIT:
In the meantime, I wrote a blog post how to make separate pages per category without using a plugin:
Separate pages per tag/category with Jekyll (without plugins)
Github pages only support a small number of Jekyll plugins.
If you want to use your plugins, you'll have to generate your site locally and push it on github pages. If you do this, add a .nojekyll file at the root of your repository to tell github to not process you files.

Jekyll paginator generates no pages

I'm having an issue with pagination in Jekyll. It doesn't seem like the paginator liquid tag is doing anything at all. Whenever i replace my for loop on my main index.html page,
{% for post in site.posts %}
with
{% for post in paginator.posts %}
no posts will appear (they appear properly with the first tag).
My _config.yml file does have the following added to it:
paginate: 1
paginate_path: "page:num"
If I try to use another paginator tag such as {{ paginator.total_posts }}, nothing appears.
I'm trying this by deploying locally, but the final pages go onto github pages. Can anybody tell me why it doesn't seem like the paginator tag is working?
The issue here wasn't with the paginator tag, it was with the paginate tag within the _config.yml file. I had forked this from Jekyll Bootstrap, which has a variable called JB within the _config file. When I added the paginate tag, I added it, but I added it as a sub-variable to JB instead of as a top-level variable. Removing the indentation on the paginate variable fixed this issue
Jekyll 3.0 deprecates pagination, so
gems: [jekyll-paginate]
must be added to _config.yml to get pagination to work again.
However, if you previously added
safe: true
to your _config.yml, like I did, no gems will be loaded–including jekyll-paginate! Removing safe: true and adding gems: [jekyll-paginate] will allow Jekyll 3.0 to perform pagination again.